Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Change Form to No Save

Discussion in 'Information Technology' started by Bob, Jul 28, 2006.

Tags:
  1. Bob

    Bob
    Expand Collapse
    Guest

    Is it possible to change this Code so if "cbOwnerID" is empty it will not
    save!
    VBA Code:
    Private Sub cmdClose_Click()
    If Me.OpenArgs = "ActiveHorses" Then
    Me.Requery
    Forms!frmActiveHorses.Visible = True
    Forms!frmActiveHorses!cbHorseName.Requery
    End If
    subSetValues
    DoCmd.Close acForm, Me.Name
    End Sub


    Thanks in advance.........Bob Vance
     
  2. Loading...

    Similar Threads Forum Date
    United Sikhs ACT NOW- BE THE CHANGE TO BRING THE CHANGE!!! Your Support can Transform the Outlook of Future Gener Sikh Organisations Aug 27, 2012
    Informing People on Unsafe Changes in Sikhi; Various Media Outlets; Not Sect-Bashing Sikh Sikhi Sikhism Nov 9, 2008
    Interfaith A Sikh Change Comes To Houston’s Finest Interfaith Dialogues Mar 3, 2016
    Angry exchanges with Christians Blogs Oct 17, 2015
    Day 1-Forever Changes, Love Blogs Oct 17, 2015

  3. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Bob,

    Try something along the lines of:

    Private Sub cmdClose_Click()
    Dim iSave As Integer
    If Me.OpenArgs = "ActiveHorses" Then
    Me.Requery
    Forms!frmActiveHorses.Visible = True
    Forms!frmActiveHorses!cbHorseName.Requery
    End If
    subSetValues
    If IsNull(Me.cbOwnerID) Then
    iSave = 2
    Else
    iSave = 1
    End If
    DoCmd.Close acForm, Me.Name, iSave
    End Sub

    HTH,
    Nikos

    Bob wrote:
    > Is it possible to change this Code so if "cbOwnerID" is empty it will not
    > save!
    > VBA Code:
    > Private Sub cmdClose_Click()
    > If Me.OpenArgs = "ActiveHorses" Then
    > Me.Requery
    > Forms!frmActiveHorses.Visible = True
    > Forms!frmActiveHorses!cbHorseName.Requery
    > End If
    > subSetValues
    > DoCmd.Close acForm, Me.Name
    > End Sub
    >
    >
    > Thanks in advance.........Bob Vance
    >
    >
     
  4. Bob

    Bob
    Expand Collapse
    Guest

    Nikos I am getting a compilr error on .cbOwnerID Thanks Bob

    "Nikos Yannacopoulos" <nyannacoREMOVETHISBIT@in.gr> wrote in message
    news:%23FfmdmghGHA.1612@TK2MSFTNGP04.phx.gbl...
    > Bob,
    >
    > Try something along the lines of:
    >
    > Private Sub cmdClose_Click()
    > Dim iSave As Integer
    > If Me.OpenArgs = "ActiveHorses" Then
    > Me.Requery
    > Forms!frmActiveHorses.Visible = True
    > Forms!frmActiveHorses!cbHorseName.Requery
    > End If
    > subSetValues
    > If IsNull(Me.cbOwnerID) Then
    > iSave = 2
    > Else
    > iSave = 1
    > End If
    > DoCmd.Close acForm, Me.Name, iSave
    > End Sub
    >
    > HTH,
    > Nikos
    >
    > Bob wrote:
    >> Is it possible to change this Code so if "cbOwnerID" is empty it will not
    >> save!
    >> VBA Code:
    >> Private Sub cmdClose_Click()
    >> If Me.OpenArgs = "ActiveHorses" Then
    >> Me.Requery
    >> Forms!frmActiveHorses.Visible = True
    >> Forms!frmActiveHorses!cbHorseName.Requery
    >> End If
    >> subSetValues
    >> DoCmd.Close acForm, Me.Name
    >> End Sub
    >>
    >>
    >> Thanks in advance.........Bob Vance
     
  5. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    What does the compiler error say? Any chance the combo name is misspelt?
    Is your code exactly as below? If not please post your exact code.

    Nikos

    Bob wrote:
    > Nikos I am getting a compilr error on .cbOwnerID Thanks Bob
    >
    > "Nikos Yannacopoulos" <nyannacoREMOVETHISBIT@in.gr> wrote in message
    > news:%23FfmdmghGHA.1612@TK2MSFTNGP04.phx.gbl...
    >> Bob,
    >>
    >> Try something along the lines of:
    >>
    >> Private Sub cmdClose_Click()
    >> Dim iSave As Integer
    >> If Me.OpenArgs = "ActiveHorses" Then
    >> Me.Requery
    >> Forms!frmActiveHorses.Visible = True
    >> Forms!frmActiveHorses!cbHorseName.Requery
    >> End If
    >> subSetValues
    >> If IsNull(Me.cbOwnerID) Then
    >> iSave = 2
    >> Else
    >> iSave = 1
    >> End If
    >> DoCmd.Close acForm, Me.Name, iSave
    >> End Sub
    >>
    >> HTH,
    >> Nikos
     
  6. Bob

    Bob
    Expand Collapse
    Guest

    Code is the same, I tried dropping the cb but still got the same error
    Compile error
    Methord or Data member not found
    and cbOwnerID is highlighted
    if i Form Design the second time I get subHorseDetails
    Thanks Bob

    "Nikos Yannacopoulos" <nyannacoREMOVETHISBIT@in.gr> wrote in message
    news:%23eQThwihGHA.2188@TK2MSFTNGP04.phx.gbl...
    > What does the compiler error say? Any chance the combo name is misspelt?
    > Is your code exactly as below? If not please post your exact code.
    >
    > Nikos
    >
    > Bob wrote:
    >> Nikos I am getting a compilr error on .cbOwnerID Thanks Bob
    >>
    >> "Nikos Yannacopoulos" <nyannacoREMOVETHISBIT@in.gr> wrote in message
    >> news:%23FfmdmghGHA.1612@TK2MSFTNGP04.phx.gbl...
    >>> Bob,
    >>>
    >>> Try something along the lines of:
    >>>
    >>> Private Sub cmdClose_Click()
    >>> Dim iSave As Integer
    >>> If Me.OpenArgs = "ActiveHorses" Then
    >>> Me.Requery
    >>> Forms!frmActiveHorses.Visible = True
    >>> Forms!frmActiveHorses!cbHorseName.Requery
    >>> End If
    >>> subSetValues
    >>> If IsNull(Me.cbOwnerID) Then
    >>> iSave = 2
    >>> Else
    >>> iSave = 1
    >>> End If
    >>> DoCmd.Close acForm, Me.Name, iSave
    >>> End Sub
    >>>
    >>> HTH,
    >>> Nikos
     
  7. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Bob,

    This says Me.cbOwnerID is not a valid object reference. There are two
    possible reasons for this, either (a) the combo is not actually called
    cbOwnerID (check the Name property in form design), or (b) the command
    button and the combo are not both on the same form (any chance one is on
    the main form and the othe on a subform?). Please check and confirm.

    Nikos
     

Share This Page