Welcome to SPN

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

Sign Up Now!

Missing a line in my Code

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

Tags:
  1. Bob

    Bob
    Expand Collapse
    Guest

    After the MsgBox line I must be missing something for it to work, and can I
    change "Yes" to "Ok"

    Private Sub Command98_Click()
    If MsgBox("Does this horse have a Client") = vbYes Then
    On Error GoTo Err_Command98_Click


    DoCmd.GoToRecord , , acNewRec

    Exit_Command98_Click:
    Exit Sub

    Err_Command98_Click:
    MsgBox Err.Description
    Resume Exit_Command98_Click
    End If

    End Sub


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

    Similar Threads Forum Date
    Pacific Oil slicks spotted in search for missing Malaysia Airlines plane (Live updates) Breaking News Mar 8, 2014
    Heritage The curious case of Maharaja's 'missing' painting History of Sikhism Oct 29, 2013
    India Half of the missing children in 2013 remain untraced in India Breaking News Sep 3, 2013
    Note to admin: Missing post Literature Jul 7, 2013
    Malaysia Missing woman found dead Breaking News Jul 3, 2013

  3. Bob

    Bob
    Expand Collapse
    Guest

    Played around with it and seem to get it to go now
    Does this look correct to you???.....Thanks bob
    Private Sub Command98_Click()
    If MsgBox("Does this horse have a Client") = vbYes Then
    Exit Sub
    End If
    On Error GoTo Err_Command98_Click


    DoCmd.GoToRecord , , acNewRec

    Exit_Command98_Click:
    Exit Sub

    Err_Command98_Click:
    MsgBox Err.Description
    Resume Exit_Command98_Click


    End Sub
    "Bob" <xxx@xx.xx> wrote in message news:e62gh1$dq9$1@lust.ihug.co.nz...
    > After the MsgBox line I must be missing something for it to work, and can
    > I change "Yes" to "Ok"
    >
    > Private Sub Command98_Click()
    > If MsgBox("Does this horse have a Client") = vbYes Then
    > On Error GoTo Err_Command98_Click
    >
    >
    > DoCmd.GoToRecord , , acNewRec
    >
    > Exit_Command98_Click:
    > Exit Sub
    >
    > Err_Command98_Click:
    > MsgBox Err.Description
    > Resume Exit_Command98_Click
    > End If
    >
    > End Sub
    >
    >
    > Thanks in advance.........Bob Vance
    >
     
  4. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    Hi Bob (fellow Kiwi? :)

    The default MsgBox has only one button - "OK". If you want to give the user
    a choice you need at least two buttons.

    The second argument for MsgBox allows you to specify options such as the
    buttons to show and the icon to display.

    For example, you could say:

    If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) = vbYes
    Then

    This will display Yes and No buttons and a question mark icon. The function
    will return the value vbYes only if the "Yes" button was clicked.

    As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    vbAbortRetryCancel (the latter two have three buttons).

    Also, it is not incorrect, but it is most unusual to enclose your entire
    procedure body in an If...EndIf block.

    You should change this to:

    On Error ...
    If MsgBox ... Then
    DoCmd.GoToRecord , , acNewRec
    End If

    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand

    "Bob" <xxx@xx.xx> wrote in message news:e62gh1$dq9$1@lust.ihug.co.nz...
    > After the MsgBox line I must be missing something for it to work, and can
    > I change "Yes" to "Ok"
    >
    > Private Sub Command98_Click()
    > If MsgBox("Does this horse have a Client") = vbYes Then
    > On Error GoTo Err_Command98_Click
    >
    >
    > DoCmd.GoToRecord , , acNewRec
    >
    > Exit_Command98_Click:
    > Exit Sub
    >
    > Err_Command98_Click:
    > MsgBox Err.Description
    > Resume Exit_Command98_Click
    > End If
    >
    > End Sub
    >
    >
    > Thanks in advance.........Bob Vance
    >
     
  5. Bob

    Bob
    Expand Collapse
    Guest

    Oops that was closing my application down, Does this code look ok?
    Asks a question first before proceeding to a new form!
    Private Sub Command98_Click()
    If MsgBox("Does this Horse have a Client!", vbQuestion + vbYesNo) = vbNo
    Then


    Exit Sub
    End If
    On Error GoTo Err_Command98_Click


    DoCmd.GoToRecord , , acNewRec

    Exit_Command98_Click:
    Exit Sub

    Err_Command98_Click:
    MsgBox Err.Description
    Resume Exit_Command98_Click
     
  6. Bob

    Bob
    Expand Collapse
    Guest

    Thanx Graham got it now!

    "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    > Hi Bob (fellow Kiwi? :)
    >
    > The default MsgBox has only one button - "OK". If you want to give the
    > user a choice you need at least two buttons.
    >
    > The second argument for MsgBox allows you to specify options such as the
    > buttons to show and the icon to display.
    >
    > For example, you could say:
    >
    > If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) = vbYes
    > Then
    >
    > This will display Yes and No buttons and a question mark icon. The
    > function will return the value vbYes only if the "Yes" button was clicked.
    >
    > As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    > vbAbortRetryCancel (the latter two have three buttons).
    >
    > Also, it is not incorrect, but it is most unusual to enclose your entire
    > procedure body in an If...EndIf block.
    >
    > You should change this to:
    >
    > On Error ...
    > If MsgBox ... Then
    > DoCmd.GoToRecord , , acNewRec
    > End If
    >
    > --
    > Good Luck!
    >
    > Graham Mandeno [Access MVP]
    > Auckland, New Zealand
    >
    > "Bob" <xxx@xx.xx> wrote in message news:e62gh1$dq9$1@lust.ihug.co.nz...
    >> After the MsgBox line I must be missing something for it to work, and can
    >> I change "Yes" to "Ok"
    >>
    >> Private Sub Command98_Click()
    >> If MsgBox("Does this horse have a Client") = vbYes Then
    >> On Error GoTo Err_Command98_Click
    >>
    >>
    >> DoCmd.GoToRecord , , acNewRec
    >>
    >> Exit_Command98_Click:
    >> Exit Sub
    >>
    >> Err_Command98_Click:
    >> MsgBox Err.Description
    >> Resume Exit_Command98_Click
    >> End If
    >>
    >> End Sub
    >>
    >>
    >> Thanks in advance.........Bob Vance
    >>

    >
    >
     
  7. Bob

    Bob
    Expand Collapse
    Guest

    Graham I have a form that has a combo Box that has 2 options (Active &
    Finished)cbStatus, and another combo box that list clients, is possible to
    lock The clients Combo Box cbOwnerID when it is in active mode and unlock
    when in finished mode
    Thanks Bob (Papakura)

    "Bob" <xxx@xx.xx> wrote in message news:e653th$57p$1@lust.ihug.co.nz...
    > Thanx Graham got it now!
    >
    > "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    > news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >> Hi Bob (fellow Kiwi? :)
    >>
    >> The default MsgBox has only one button - "OK". If you want to give the
    >> user a choice you need at least two buttons.
    >>
    >> The second argument for MsgBox allows you to specify options such as the
    >> buttons to show and the icon to display.
    >>
    >> For example, you could say:
    >>
    >> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) = vbYes
    >> Then
    >>
    >> This will display Yes and No buttons and a question mark icon. The
    >> function will return the value vbYes only if the "Yes" button was
    >> clicked.
    >>
    >> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >> vbAbortRetryCancel (the latter two have three buttons).
    >>
    >> Also, it is not incorrect, but it is most unusual to enclose your entire
    >> procedure body in an If...EndIf block.
    >>
    >> You should change this to:
    >>
    >> On Error ...
    >> If MsgBox ... Then
    >> DoCmd.GoToRecord , , acNewRec
    >> End If
    >>
    >> --
    >> Good Luck!
    >>
    >> Graham Mandeno [Access MVP]
    >> Auckland, New Zealand
    >>
    >> "Bob" <xxx@xx.xx> wrote in message news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>> After the MsgBox line I must be missing something for it to work, and
    >>> can I change "Yes" to "Ok"
    >>>
    >>> Private Sub Command98_Click()
    >>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>> On Error GoTo Err_Command98_Click
    >>>
    >>>
    >>> DoCmd.GoToRecord , , acNewRec
    >>>
    >>> Exit_Command98_Click:
    >>> Exit Sub
    >>>
    >>> Err_Command98_Click:
    >>> MsgBox Err.Description
    >>> Resume Exit_Command98_Click
    >>> End If
    >>>
    >>> End Sub
    >>>
    >>>
    >>> Thanks in advance.........Bob Vance
    >>>

    >>
    >>

    >
    >
     
  8. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    Hi Bob

    Sorry, I've been away for a few days.

    Yes, this is certainly possible. In the AfterUpdate event for cbStatus, AND
    in the Current event for your form, add the following code:

    cbOwnerID.Locked = (cbStatus = "Finished")

    Does Status have any options other than "Active" and "Finished"? If not,
    you might consider making it a boolean (yes/no) field bound to a checkbox.
    This would save real estate on your form and would probably make the user
    interface more intuitive.
    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand - Torbay :)

    "Bob" <xxx@xx.xx> wrote in message news:e654c7$68k$1@lust.ihug.co.nz...
    > Graham I have a form that has a combo Box that has 2 options (Active &
    > Finished)cbStatus, and another combo box that list clients, is possible to
    > lock The clients Combo Box cbOwnerID when it is in active mode and unlock
    > when in finished mode
    > Thanks Bob (Papakura)
    >
    > "Bob" <xxx@xx.xx> wrote in message news:e653th$57p$1@lust.ihug.co.nz...
    >> Thanx Graham got it now!
    >>
    >> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>> Hi Bob (fellow Kiwi? :)
    >>>
    >>> The default MsgBox has only one button - "OK". If you want to give the
    >>> user a choice you need at least two buttons.
    >>>
    >>> The second argument for MsgBox allows you to specify options such as the
    >>> buttons to show and the icon to display.
    >>>
    >>> For example, you could say:
    >>>
    >>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) = vbYes
    >>> Then
    >>>
    >>> This will display Yes and No buttons and a question mark icon. The
    >>> function will return the value vbYes only if the "Yes" button was
    >>> clicked.
    >>>
    >>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>> vbAbortRetryCancel (the latter two have three buttons).
    >>>
    >>> Also, it is not incorrect, but it is most unusual to enclose your entire
    >>> procedure body in an If...EndIf block.
    >>>
    >>> You should change this to:
    >>>
    >>> On Error ...
    >>> If MsgBox ... Then
    >>> DoCmd.GoToRecord , , acNewRec
    >>> End If
    >>>
    >>> --
    >>> Good Luck!
    >>>
    >>> Graham Mandeno [Access MVP]
    >>> Auckland, New Zealand
    >>>
    >>> "Bob" <xxx@xx.xx> wrote in message news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>> After the MsgBox line I must be missing something for it to work, and
    >>>> can I change "Yes" to "Ok"
    >>>>
    >>>> Private Sub Command98_Click()
    >>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>> On Error GoTo Err_Command98_Click
    >>>>
    >>>>
    >>>> DoCmd.GoToRecord , , acNewRec
    >>>>
    >>>> Exit_Command98_Click:
    >>>> Exit Sub
    >>>>
    >>>> Err_Command98_Click:
    >>>> MsgBox Err.Description
    >>>> Resume Exit_Command98_Click
    >>>> End If
    >>>>
    >>>> End Sub
    >>>>
    >>>>
    >>>> Thanks in advance.........Bob Vance
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  9. Bob

    Bob
    Expand Collapse
    Guest

    No Graham just has the two (Active,Finished), should this be done another
    way?.....Regards Bob Vance

    "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    > Hi Bob
    >
    > Sorry, I've been away for a few days.
    >
    > Yes, this is certainly possible. In the AfterUpdate event for cbStatus,
    > AND in the Current event for your form, add the following code:
    >
    > cbOwnerID.Locked = (cbStatus = "Finished")
    >
    > Does Status have any options other than "Active" and "Finished"? If not,
    > you might consider making it a boolean (yes/no) field bound to a checkbox.
    > This would save real estate on your form and would probably make the user
    > interface more intuitive.
    > --
    > Good Luck!
    >
    > Graham Mandeno [Access MVP]
    > Auckland, New Zealand - Torbay :)
    >
    > "Bob" <xxx@xx.xx> wrote in message news:e654c7$68k$1@lust.ihug.co.nz...
    >> Graham I have a form that has a combo Box that has 2 options (Active &
    >> Finished)cbStatus, and another combo box that list clients, is possible
    >> to lock The clients Combo Box cbOwnerID when it is in active mode and
    >> unlock when in finished mode
    >> Thanks Bob (Papakura)
    >>
    >> "Bob" <xxx@xx.xx> wrote in message news:e653th$57p$1@lust.ihug.co.nz...
    >>> Thanx Graham got it now!
    >>>
    >>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>> Hi Bob (fellow Kiwi? :)
    >>>>
    >>>> The default MsgBox has only one button - "OK". If you want to give the
    >>>> user a choice you need at least two buttons.
    >>>>
    >>>> The second argument for MsgBox allows you to specify options such as
    >>>> the buttons to show and the icon to display.
    >>>>
    >>>> For example, you could say:
    >>>>
    >>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) =
    >>>> vbYes Then
    >>>>
    >>>> This will display Yes and No buttons and a question mark icon. The
    >>>> function will return the value vbYes only if the "Yes" button was
    >>>> clicked.
    >>>>
    >>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>
    >>>> Also, it is not incorrect, but it is most unusual to enclose your
    >>>> entire procedure body in an If...EndIf block.
    >>>>
    >>>> You should change this to:
    >>>>
    >>>> On Error ...
    >>>> If MsgBox ... Then
    >>>> DoCmd.GoToRecord , , acNewRec
    >>>> End If
    >>>>
    >>>> --
    >>>> Good Luck!
    >>>>
    >>>> Graham Mandeno [Access MVP]
    >>>> Auckland, New Zealand
    >>>>
    >>>> "Bob" <xxx@xx.xx> wrote in message news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>> After the MsgBox line I must be missing something for it to work, and
    >>>>> can I change "Yes" to "Ok"
    >>>>>
    >>>>> Private Sub Command98_Click()
    >>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>> On Error GoTo Err_Command98_Click
    >>>>>
    >>>>>
    >>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>
    >>>>> Exit_Command98_Click:
    >>>>> Exit Sub
    >>>>>
    >>>>> Err_Command98_Click:
    >>>>> MsgBox Err.Description
    >>>>> Resume Exit_Command98_Click
    >>>>> End If
    >>>>>
    >>>>> End Sub
    >>>>>
    >>>>>
    >>>>> Thanks in advance.........Bob Vance
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  10. Bob

    Bob
    Expand Collapse
    Guest

    Could not find this:
    AND
    in the Current event for your form, add the following code:
    Thanx..Bob
    "Bob" <xxx@xx.xx> wrote in message news:e6fs5l$b80$1@lust.ihug.co.nz...
    > No Graham just has the two (Active,Finished), should this be done another
    > way?.....Regards Bob Vance
    >
    > "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    > news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    >> Hi Bob
    >>
    >> Sorry, I've been away for a few days.
    >>
    >> Yes, this is certainly possible. In the AfterUpdate event for cbStatus,
    >> AND in the Current event for your form, add the following code:
    >>
    >> cbOwnerID.Locked = (cbStatus = "Finished")
    >>
    >> Does Status have any options other than "Active" and "Finished"? If not,
    >> you might consider making it a boolean (yes/no) field bound to a
    >> checkbox. This would save real estate on your form and would probably
    >> make the user interface more intuitive.
    >> --
    >> Good Luck!
    >>
    >> Graham Mandeno [Access MVP]
    >> Auckland, New Zealand - Torbay :)
    >>
    >> "Bob" <xxx@xx.xx> wrote in message news:e654c7$68k$1@lust.ihug.co.nz...
    >>> Graham I have a form that has a combo Box that has 2 options (Active &
    >>> Finished)cbStatus, and another combo box that list clients, is possible
    >>> to lock The clients Combo Box cbOwnerID when it is in active mode and
    >>> unlock when in finished mode
    >>> Thanks Bob (Papakura)
    >>>
    >>> "Bob" <xxx@xx.xx> wrote in message news:e653th$57p$1@lust.ihug.co.nz...
    >>>> Thanx Graham got it now!
    >>>>
    >>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>>> Hi Bob (fellow Kiwi? :)
    >>>>>
    >>>>> The default MsgBox has only one button - "OK". If you want to give
    >>>>> the user a choice you need at least two buttons.
    >>>>>
    >>>>> The second argument for MsgBox allows you to specify options such as
    >>>>> the buttons to show and the icon to display.
    >>>>>
    >>>>> For example, you could say:
    >>>>>
    >>>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) =
    >>>>> vbYes Then
    >>>>>
    >>>>> This will display Yes and No buttons and a question mark icon. The
    >>>>> function will return the value vbYes only if the "Yes" button was
    >>>>> clicked.
    >>>>>
    >>>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>>
    >>>>> Also, it is not incorrect, but it is most unusual to enclose your
    >>>>> entire procedure body in an If...EndIf block.
    >>>>>
    >>>>> You should change this to:
    >>>>>
    >>>>> On Error ...
    >>>>> If MsgBox ... Then
    >>>>> DoCmd.GoToRecord , , acNewRec
    >>>>> End If
    >>>>>
    >>>>> --
    >>>>> Good Luck!
    >>>>>
    >>>>> Graham Mandeno [Access MVP]
    >>>>> Auckland, New Zealand
    >>>>>
    >>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>> news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>>> After the MsgBox line I must be missing something for it to work, and
    >>>>>> can I change "Yes" to "Ok"
    >>>>>>
    >>>>>> Private Sub Command98_Click()
    >>>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>>> On Error GoTo Err_Command98_Click
    >>>>>>
    >>>>>>
    >>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>
    >>>>>> Exit_Command98_Click:
    >>>>>> Exit Sub
    >>>>>>
    >>>>>> Err_Command98_Click:
    >>>>>> MsgBox Err.Description
    >>>>>> Resume Exit_Command98_Click
    >>>>>> End If
    >>>>>>
    >>>>>> End Sub
    >>>>>>
    >>>>>>
    >>>>>> Thanks in advance.........Bob Vance
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  11. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    Hi Bob

    With the form open in design view and the properties window displayed
    (View>Properties), select the form (click the grey square in the top left,
    or use Ctrl-R). Now, in the properties window, on the Event tab, scroll
    down until you see "On Current". Type a left-square-bracket "[" in the cell
    and "[Event Procedure]" should appear. Then click the three dots button to
    the right of the cell. The VBA code window should open showing (among other
    things):

    Private Sub Form_Current()
    | <<< cursor is here
    End Sub

    This is the event procedure for your form's Current event. That's where the
    code goes.

    What I meant about a boolean field was to have a yes/no field in your table
    named "Finished". You can then bind this to a checkbox on your form and a
    single click will put a tick in the box (Finished) or clear it (Active).

    Your code below would then change to:

    cbOwnerID.Locked = Me.Finished

    BTW, I know horses are pretty important in your neck of the woods, but they
    have clients???
    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand


    "Bob" <xxx@xx.xx> wrote in message news:e6ft15$ctt$1@lust.ihug.co.nz...
    > Could not find this:
    > AND
    > in the Current event for your form, add the following code:
    > Thanx..Bob
    > "Bob" <xxx@xx.xx> wrote in message news:e6fs5l$b80$1@lust.ihug.co.nz...
    >> No Graham just has the two (Active,Finished), should this be done another
    >> way?.....Regards Bob Vance
    >>
    >> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >> news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    >>> Hi Bob
    >>>
    >>> Sorry, I've been away for a few days.
    >>>
    >>> Yes, this is certainly possible. In the AfterUpdate event for cbStatus,
    >>> AND in the Current event for your form, add the following code:
    >>>
    >>> cbOwnerID.Locked = (cbStatus = "Finished")
    >>>
    >>> Does Status have any options other than "Active" and "Finished"? If
    >>> not, you might consider making it a boolean (yes/no) field bound to a
    >>> checkbox. This would save real estate on your form and would probably
    >>> make the user interface more intuitive.
    >>> --
    >>> Good Luck!
    >>>
    >>> Graham Mandeno [Access MVP]
    >>> Auckland, New Zealand - Torbay :)
    >>>
    >>> "Bob" <xxx@xx.xx> wrote in message news:e654c7$68k$1@lust.ihug.co.nz...
    >>>> Graham I have a form that has a combo Box that has 2 options (Active &
    >>>> Finished)cbStatus, and another combo box that list clients, is possible
    >>>> to lock The clients Combo Box cbOwnerID when it is in active mode and
    >>>> unlock when in finished mode
    >>>> Thanks Bob (Papakura)
    >>>>
    >>>> "Bob" <xxx@xx.xx> wrote in message news:e653th$57p$1@lust.ihug.co.nz...
    >>>>> Thanx Graham got it now!
    >>>>>
    >>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>>>> Hi Bob (fellow Kiwi? :)
    >>>>>>
    >>>>>> The default MsgBox has only one button - "OK". If you want to give
    >>>>>> the user a choice you need at least two buttons.
    >>>>>>
    >>>>>> The second argument for MsgBox allows you to specify options such as
    >>>>>> the buttons to show and the icon to display.
    >>>>>>
    >>>>>> For example, you could say:
    >>>>>>
    >>>>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) =
    >>>>>> vbYes Then
    >>>>>>
    >>>>>> This will display Yes and No buttons and a question mark icon. The
    >>>>>> function will return the value vbYes only if the "Yes" button was
    >>>>>> clicked.
    >>>>>>
    >>>>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>>>
    >>>>>> Also, it is not incorrect, but it is most unusual to enclose your
    >>>>>> entire procedure body in an If...EndIf block.
    >>>>>>
    >>>>>> You should change this to:
    >>>>>>
    >>>>>> On Error ...
    >>>>>> If MsgBox ... Then
    >>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>> End If
    >>>>>>
    >>>>>> --
    >>>>>> Good Luck!
    >>>>>>
    >>>>>> Graham Mandeno [Access MVP]
    >>>>>> Auckland, New Zealand
    >>>>>>
    >>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>> news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>>>> After the MsgBox line I must be missing something for it to work,
    >>>>>>> and can I change "Yes" to "Ok"
    >>>>>>>
    >>>>>>> Private Sub Command98_Click()
    >>>>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>>>> On Error GoTo Err_Command98_Click
    >>>>>>>
    >>>>>>>
    >>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>
    >>>>>>> Exit_Command98_Click:
    >>>>>>> Exit Sub
    >>>>>>>
    >>>>>>> Err_Command98_Click:
    >>>>>>> MsgBox Err.Description
    >>>>>>> Resume Exit_Command98_Click
    >>>>>>> End If
    >>>>>>>
    >>>>>>> End Sub
    >>>>>>>
    >>>>>>>
    >>>>>>> Thanks in advance.........Bob Vance
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  12. Bob

    Bob
    Expand Collapse
    Guest

    Graham this is what is in there:
    Private Sub Form_Current()
    subShowValues
    End Sub

    "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    news:u9xbCrdjGHA.4344@TK2MSFTNGP05.phx.gbl...
    > Hi Bob
    >
    > With the form open in design view and the properties window displayed
    > (View>Properties), select the form (click the grey square in the top left,
    > or use Ctrl-R). Now, in the properties window, on the Event tab, scroll
    > down until you see "On Current". Type a left-square-bracket "[" in the
    > cell and "[Event Procedure]" should appear. Then click the three dots
    > button to the right of the cell. The VBA code window should open showing
    > (among other things):
    >
    > Private Sub Form_Current()
    > | <<< cursor is here
    > End Sub
    >
    > This is the event procedure for your form's Current event. That's where
    > the code goes.
    >
    > What I meant about a boolean field was to have a yes/no field in your
    > table named "Finished". You can then bind this to a checkbox on your form
    > and a single click will put a tick in the box (Finished) or clear it
    > (Active).
    >
    > Your code below would then change to:
    >
    > cbOwnerID.Locked = Me.Finished
    >
    > BTW, I know horses are pretty important in your neck of the woods, but
    > they have clients???
    > --
    > Good Luck!
    >
    > Graham Mandeno [Access MVP]
    > Auckland, New Zealand
    >
    >
    > "Bob" <xxx@xx.xx> wrote in message news:e6ft15$ctt$1@lust.ihug.co.nz...
    >> Could not find this:
    >> AND
    >> in the Current event for your form, add the following code:
    >> Thanx..Bob
    >> "Bob" <xxx@xx.xx> wrote in message news:e6fs5l$b80$1@lust.ihug.co.nz...
    >>> No Graham just has the two (Active,Finished), should this be done
    >>> another way?.....Regards Bob Vance
    >>>
    >>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>> news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    >>>> Hi Bob
    >>>>
    >>>> Sorry, I've been away for a few days.
    >>>>
    >>>> Yes, this is certainly possible. In the AfterUpdate event for
    >>>> cbStatus, AND in the Current event for your form, add the following
    >>>> code:
    >>>>
    >>>> cbOwnerID.Locked = (cbStatus = "Finished")
    >>>>
    >>>> Does Status have any options other than "Active" and "Finished"? If
    >>>> not, you might consider making it a boolean (yes/no) field bound to a
    >>>> checkbox. This would save real estate on your form and would probably
    >>>> make the user interface more intuitive.
    >>>> --
    >>>> Good Luck!
    >>>>
    >>>> Graham Mandeno [Access MVP]
    >>>> Auckland, New Zealand - Torbay :)
    >>>>
    >>>> "Bob" <xxx@xx.xx> wrote in message news:e654c7$68k$1@lust.ihug.co.nz...
    >>>>> Graham I have a form that has a combo Box that has 2 options (Active
    >>>>> & Finished)cbStatus, and another combo box that list clients, is
    >>>>> possible to lock The clients Combo Box cbOwnerID when it is in active
    >>>>> mode and unlock when in finished mode
    >>>>> Thanks Bob (Papakura)
    >>>>>
    >>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>> news:e653th$57p$1@lust.ihug.co.nz...
    >>>>>> Thanx Graham got it now!
    >>>>>>
    >>>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>>>>> Hi Bob (fellow Kiwi? :)
    >>>>>>>
    >>>>>>> The default MsgBox has only one button - "OK". If you want to give
    >>>>>>> the user a choice you need at least two buttons.
    >>>>>>>
    >>>>>>> The second argument for MsgBox allows you to specify options such as
    >>>>>>> the buttons to show and the icon to display.
    >>>>>>>
    >>>>>>> For example, you could say:
    >>>>>>>
    >>>>>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) =
    >>>>>>> vbYes Then
    >>>>>>>
    >>>>>>> This will display Yes and No buttons and a question mark icon. The
    >>>>>>> function will return the value vbYes only if the "Yes" button was
    >>>>>>> clicked.
    >>>>>>>
    >>>>>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>>>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>>>>
    >>>>>>> Also, it is not incorrect, but it is most unusual to enclose your
    >>>>>>> entire procedure body in an If...EndIf block.
    >>>>>>>
    >>>>>>> You should change this to:
    >>>>>>>
    >>>>>>> On Error ...
    >>>>>>> If MsgBox ... Then
    >>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>> End If
    >>>>>>>
    >>>>>>> --
    >>>>>>> Good Luck!
    >>>>>>>
    >>>>>>> Graham Mandeno [Access MVP]
    >>>>>>> Auckland, New Zealand
    >>>>>>>
    >>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>> news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>>>>> After the MsgBox line I must be missing something for it to work,
    >>>>>>>> and can I change "Yes" to "Ok"
    >>>>>>>>
    >>>>>>>> Private Sub Command98_Click()
    >>>>>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>>>>> On Error GoTo Err_Command98_Click
    >>>>>>>>
    >>>>>>>>
    >>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>
    >>>>>>>> Exit_Command98_Click:
    >>>>>>>> Exit Sub
    >>>>>>>>
    >>>>>>>> Err_Command98_Click:
    >>>>>>>> MsgBox Err.Description
    >>>>>>>> Resume Exit_Command98_Click
    >>>>>>>> End If
    >>>>>>>>
    >>>>>>>> End Sub
    >>>>>>>>
    >>>>>>>>
    >>>>>>>> Thanks in advance.........Bob Vance
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  13. Bob

    Bob
    Expand Collapse
    Guest

    I do have this code on the delete button of client:

    Private Sub Command13_Click()
    On Error GoTo Err_Command13_Click
    Dim nRtnValue As Integer
    nRtnValue = MsgBox("Are you sure you want to Delete this Client ?
    Horse must have a least one Client!", vbCritical + vbYesNo, "Delete Client")
    If nRtnValue = vbYes Then
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

    Exit_Command13_Click:
    Exit Sub

    Err_Command13_Click:
    MsgBox Err.Description
    Resume Exit_Command13_Click
    End If

    End Sub
     
  14. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    So, your Form_Current event proc is already doing something (i.e. calling
    the Sub named "subShowvalues")

    No matter - you want it to also do something else, so add your line of code
    after that one.
    --
    Good Luck!

    Graham Mandeno [Access MVP]
    Auckland, New Zealand

    "Bob" <xxx@xx.xx> wrote in message news:e6iv66$mc$1@lust.ihug.co.nz...
    > Graham this is what is in there:
    > Private Sub Form_Current()
    > subShowValues
    > End Sub
    >
    > "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    > news:u9xbCrdjGHA.4344@TK2MSFTNGP05.phx.gbl...
    >> Hi Bob
    >>
    >> With the form open in design view and the properties window displayed
    >> (View>Properties), select the form (click the grey square in the top
    >> left, or use Ctrl-R). Now, in the properties window, on the Event tab,
    >> scroll down until you see "On Current". Type a left-square-bracket "["
    >> in the cell and "[Event Procedure]" should appear. Then click the three
    >> dots button to the right of the cell. The VBA code window should open
    >> showing (among other things):
    >>
    >> Private Sub Form_Current()
    >> | <<< cursor is here
    >> End Sub
    >>
    >> This is the event procedure for your form's Current event. That's where
    >> the code goes.
    >>
    >> What I meant about a boolean field was to have a yes/no field in your
    >> table named "Finished". You can then bind this to a checkbox on your
    >> form and a single click will put a tick in the box (Finished) or clear it
    >> (Active).
    >>
    >> Your code below would then change to:
    >>
    >> cbOwnerID.Locked = Me.Finished
    >>
    >> BTW, I know horses are pretty important in your neck of the woods, but
    >> they have clients???
    >> --
    >> Good Luck!
    >>
    >> Graham Mandeno [Access MVP]
    >> Auckland, New Zealand
    >>
    >>
    >> "Bob" <xxx@xx.xx> wrote in message news:e6ft15$ctt$1@lust.ihug.co.nz...
    >>> Could not find this:
    >>> AND
    >>> in the Current event for your form, add the following code:
    >>> Thanx..Bob
    >>> "Bob" <xxx@xx.xx> wrote in message news:e6fs5l$b80$1@lust.ihug.co.nz...
    >>>> No Graham just has the two (Active,Finished), should this be done
    >>>> another way?.....Regards Bob Vance
    >>>>
    >>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>> news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    >>>>> Hi Bob
    >>>>>
    >>>>> Sorry, I've been away for a few days.
    >>>>>
    >>>>> Yes, this is certainly possible. In the AfterUpdate event for
    >>>>> cbStatus, AND in the Current event for your form, add the following
    >>>>> code:
    >>>>>
    >>>>> cbOwnerID.Locked = (cbStatus = "Finished")
    >>>>>
    >>>>> Does Status have any options other than "Active" and "Finished"? If
    >>>>> not, you might consider making it a boolean (yes/no) field bound to a
    >>>>> checkbox. This would save real estate on your form and would probably
    >>>>> make the user interface more intuitive.
    >>>>> --
    >>>>> Good Luck!
    >>>>>
    >>>>> Graham Mandeno [Access MVP]
    >>>>> Auckland, New Zealand - Torbay :)
    >>>>>
    >>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>> news:e654c7$68k$1@lust.ihug.co.nz...
    >>>>>> Graham I have a form that has a combo Box that has 2 options (Active
    >>>>>> & Finished)cbStatus, and another combo box that list clients, is
    >>>>>> possible to lock The clients Combo Box cbOwnerID when it is in active
    >>>>>> mode and unlock when in finished mode
    >>>>>> Thanks Bob (Papakura)
    >>>>>>
    >>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>> news:e653th$57p$1@lust.ihug.co.nz...
    >>>>>>> Thanx Graham got it now!
    >>>>>>>
    >>>>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>>>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>>>>>> Hi Bob (fellow Kiwi? :)
    >>>>>>>>
    >>>>>>>> The default MsgBox has only one button - "OK". If you want to give
    >>>>>>>> the user a choice you need at least two buttons.
    >>>>>>>>
    >>>>>>>> The second argument for MsgBox allows you to specify options such
    >>>>>>>> as the buttons to show and the icon to display.
    >>>>>>>>
    >>>>>>>> For example, you could say:
    >>>>>>>>
    >>>>>>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) =
    >>>>>>>> vbYes Then
    >>>>>>>>
    >>>>>>>> This will display Yes and No buttons and a question mark icon. The
    >>>>>>>> function will return the value vbYes only if the "Yes" button was
    >>>>>>>> clicked.
    >>>>>>>>
    >>>>>>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>>>>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>>>>>
    >>>>>>>> Also, it is not incorrect, but it is most unusual to enclose your
    >>>>>>>> entire procedure body in an If...EndIf block.
    >>>>>>>>
    >>>>>>>> You should change this to:
    >>>>>>>>
    >>>>>>>> On Error ...
    >>>>>>>> If MsgBox ... Then
    >>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>> End If
    >>>>>>>>
    >>>>>>>> --
    >>>>>>>> Good Luck!
    >>>>>>>>
    >>>>>>>> Graham Mandeno [Access MVP]
    >>>>>>>> Auckland, New Zealand
    >>>>>>>>
    >>>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>>> news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>>>>>> After the MsgBox line I must be missing something for it to work,
    >>>>>>>>> and can I change "Yes" to "Ok"
    >>>>>>>>>
    >>>>>>>>> Private Sub Command98_Click()
    >>>>>>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>>>>>> On Error GoTo Err_Command98_Click
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>>
    >>>>>>>>> Exit_Command98_Click:
    >>>>>>>>> Exit Sub
    >>>>>>>>>
    >>>>>>>>> Err_Command98_Click:
    >>>>>>>>> MsgBox Err.Description
    >>>>>>>>> Resume Exit_Command98_Click
    >>>>>>>>> End If
    >>>>>>>>>
    >>>>>>>>> End Sub
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>> Thanks in advance.........Bob Vance
    >>>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  15. Bob

    Bob
    Expand Collapse
    Guest

    I got a compile error on Finished , member not found
    Thanks..Bob

    "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    news:ORxP%23jgjGHA.4504@TK2MSFTNGP05.phx.gbl...
    > So, your Form_Current event proc is already doing something (i.e. calling
    > the Sub named "subShowvalues")
    >
    > No matter - you want it to also do something else, so add your line of
    > code after that one.
    > --
    > Good Luck!
    >
    > Graham Mandeno [Access MVP]
    > Auckland, New Zealand
    >
    > "Bob" <xxx@xx.xx> wrote in message news:e6iv66$mc$1@lust.ihug.co.nz...
    >> Graham this is what is in there:
    >> Private Sub Form_Current()
    >> subShowValues
    >> End Sub
    >>
    >> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >> news:u9xbCrdjGHA.4344@TK2MSFTNGP05.phx.gbl...
    >>> Hi Bob
    >>>
    >>> With the form open in design view and the properties window displayed
    >>> (View>Properties), select the form (click the grey square in the top
    >>> left, or use Ctrl-R). Now, in the properties window, on the Event tab,
    >>> scroll down until you see "On Current". Type a left-square-bracket "["
    >>> in the cell and "[Event Procedure]" should appear. Then click the three
    >>> dots button to the right of the cell. The VBA code window should open
    >>> showing (among other things):
    >>>
    >>> Private Sub Form_Current()
    >>> | <<< cursor is here
    >>> End Sub
    >>>
    >>> This is the event procedure for your form's Current event. That's where
    >>> the code goes.
    >>>
    >>> What I meant about a boolean field was to have a yes/no field in your
    >>> table named "Finished". You can then bind this to a checkbox on your
    >>> form and a single click will put a tick in the box (Finished) or clear
    >>> it (Active).
    >>>
    >>> Your code below would then change to:
    >>>
    >>> cbOwnerID.Locked = Me.Finished
    >>>
    >>> BTW, I know horses are pretty important in your neck of the woods, but
    >>> they have clients???
    >>> --
    >>> Good Luck!
    >>>
    >>> Graham Mandeno [Access MVP]
    >>> Auckland, New Zealand
    >>>
    >>>
    >>> "Bob" <xxx@xx.xx> wrote in message news:e6ft15$ctt$1@lust.ihug.co.nz...
    >>>> Could not find this:
    >>>> AND
    >>>> in the Current event for your form, add the following code:
    >>>> Thanx..Bob
    >>>> "Bob" <xxx@xx.xx> wrote in message news:e6fs5l$b80$1@lust.ihug.co.nz...
    >>>>> No Graham just has the two (Active,Finished), should this be done
    >>>>> another way?.....Regards Bob Vance
    >>>>>
    >>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>> news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    >>>>>> Hi Bob
    >>>>>>
    >>>>>> Sorry, I've been away for a few days.
    >>>>>>
    >>>>>> Yes, this is certainly possible. In the AfterUpdate event for
    >>>>>> cbStatus, AND in the Current event for your form, add the following
    >>>>>> code:
    >>>>>>
    >>>>>> cbOwnerID.Locked = (cbStatus = "Finished")
    >>>>>>
    >>>>>> Does Status have any options other than "Active" and "Finished"? If
    >>>>>> not, you might consider making it a boolean (yes/no) field bound to a
    >>>>>> checkbox. This would save real estate on your form and would probably
    >>>>>> make the user interface more intuitive.
    >>>>>> --
    >>>>>> Good Luck!
    >>>>>>
    >>>>>> Graham Mandeno [Access MVP]
    >>>>>> Auckland, New Zealand - Torbay :)
    >>>>>>
    >>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>> news:e654c7$68k$1@lust.ihug.co.nz...
    >>>>>>> Graham I have a form that has a combo Box that has 2 options
    >>>>>>> (Active & Finished)cbStatus, and another combo box that list
    >>>>>>> clients, is possible to lock The clients Combo Box cbOwnerID when it
    >>>>>>> is in active mode and unlock when in finished mode
    >>>>>>> Thanks Bob (Papakura)
    >>>>>>>
    >>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>> news:e653th$57p$1@lust.ihug.co.nz...
    >>>>>>>> Thanx Graham got it now!
    >>>>>>>>
    >>>>>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>>>>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>>>>>>> Hi Bob (fellow Kiwi? :)
    >>>>>>>>>
    >>>>>>>>> The default MsgBox has only one button - "OK". If you want to
    >>>>>>>>> give the user a choice you need at least two buttons.
    >>>>>>>>>
    >>>>>>>>> The second argument for MsgBox allows you to specify options such
    >>>>>>>>> as the buttons to show and the icon to display.
    >>>>>>>>>
    >>>>>>>>> For example, you could say:
    >>>>>>>>>
    >>>>>>>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion) =
    >>>>>>>>> vbYes Then
    >>>>>>>>>
    >>>>>>>>> This will display Yes and No buttons and a question mark icon.
    >>>>>>>>> The function will return the value vbYes only if the "Yes" button
    >>>>>>>>> was clicked.
    >>>>>>>>>
    >>>>>>>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>>>>>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>>>>>>
    >>>>>>>>> Also, it is not incorrect, but it is most unusual to enclose your
    >>>>>>>>> entire procedure body in an If...EndIf block.
    >>>>>>>>>
    >>>>>>>>> You should change this to:
    >>>>>>>>>
    >>>>>>>>> On Error ...
    >>>>>>>>> If MsgBox ... Then
    >>>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>> End If
    >>>>>>>>>
    >>>>>>>>> --
    >>>>>>>>> Good Luck!
    >>>>>>>>>
    >>>>>>>>> Graham Mandeno [Access MVP]
    >>>>>>>>> Auckland, New Zealand
    >>>>>>>>>
    >>>>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>>>> news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>>>>>>> After the MsgBox line I must be missing something for it to work,
    >>>>>>>>>> and can I change "Yes" to "Ok"
    >>>>>>>>>>
    >>>>>>>>>> Private Sub Command98_Click()
    >>>>>>>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>>>>>>> On Error GoTo Err_Command98_Click
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>>>
    >>>>>>>>>> Exit_Command98_Click:
    >>>>>>>>>> Exit Sub
    >>>>>>>>>>
    >>>>>>>>>> Err_Command98_Click:
    >>>>>>>>>> MsgBox Err.Description
    >>>>>>>>>> Resume Exit_Command98_Click
    >>>>>>>>>> End If
    >>>>>>>>>>
    >>>>>>>>>> End Sub
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>> Thanks in advance.........Bob Vance
    >>>>>>>>>>
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  16. Graham Mandeno

    Graham Mandeno
    Expand Collapse
    Guest

    But did you add that field to your table first? And is it included in your
    record source?

    --
    Graham Mandeno [Access MVP]
    Auckland, New Zealand

    "Bob" <xxx@xx.xx> wrote in message news:e6kqio$c0q$1@lust.ihug.co.nz...
    >I got a compile error on Finished , member not found
    > Thanks..Bob
    >
    > "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    > news:ORxP%23jgjGHA.4504@TK2MSFTNGP05.phx.gbl...
    >> So, your Form_Current event proc is already doing something (i.e. calling
    >> the Sub named "subShowvalues")
    >>
    >> No matter - you want it to also do something else, so add your line of
    >> code after that one.
    >> --
    >> Good Luck!
    >>
    >> Graham Mandeno [Access MVP]
    >> Auckland, New Zealand
    >>
    >> "Bob" <xxx@xx.xx> wrote in message news:e6iv66$mc$1@lust.ihug.co.nz...
    >>> Graham this is what is in there:
    >>> Private Sub Form_Current()
    >>> subShowValues
    >>> End Sub
    >>>
    >>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>> news:u9xbCrdjGHA.4344@TK2MSFTNGP05.phx.gbl...
    >>>> Hi Bob
    >>>>
    >>>> With the form open in design view and the properties window displayed
    >>>> (View>Properties), select the form (click the grey square in the top
    >>>> left, or use Ctrl-R). Now, in the properties window, on the Event tab,
    >>>> scroll down until you see "On Current". Type a left-square-bracket "["
    >>>> in the cell and "[Event Procedure]" should appear. Then click the
    >>>> three dots button to the right of the cell. The VBA code window should
    >>>> open showing (among other things):
    >>>>
    >>>> Private Sub Form_Current()
    >>>> | <<< cursor is here
    >>>> End Sub
    >>>>
    >>>> This is the event procedure for your form's Current event. That's
    >>>> where the code goes.
    >>>>
    >>>> What I meant about a boolean field was to have a yes/no field in your
    >>>> table named "Finished". You can then bind this to a checkbox on your
    >>>> form and a single click will put a tick in the box (Finished) or clear
    >>>> it (Active).
    >>>>
    >>>> Your code below would then change to:
    >>>>
    >>>> cbOwnerID.Locked = Me.Finished
    >>>>
    >>>> BTW, I know horses are pretty important in your neck of the woods, but
    >>>> they have clients???
    >>>> --
    >>>> Good Luck!
    >>>>
    >>>> Graham Mandeno [Access MVP]
    >>>> Auckland, New Zealand
    >>>>
    >>>>
    >>>> "Bob" <xxx@xx.xx> wrote in message news:e6ft15$ctt$1@lust.ihug.co.nz...
    >>>>> Could not find this:
    >>>>> AND
    >>>>> in the Current event for your form, add the following code:
    >>>>> Thanx..Bob
    >>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>> news:e6fs5l$b80$1@lust.ihug.co.nz...
    >>>>>> No Graham just has the two (Active,Finished), should this be done
    >>>>>> another way?.....Regards Bob Vance
    >>>>>>
    >>>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>>> news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    >>>>>>> Hi Bob
    >>>>>>>
    >>>>>>> Sorry, I've been away for a few days.
    >>>>>>>
    >>>>>>> Yes, this is certainly possible. In the AfterUpdate event for
    >>>>>>> cbStatus, AND in the Current event for your form, add the following
    >>>>>>> code:
    >>>>>>>
    >>>>>>> cbOwnerID.Locked = (cbStatus = "Finished")
    >>>>>>>
    >>>>>>> Does Status have any options other than "Active" and "Finished"? If
    >>>>>>> not, you might consider making it a boolean (yes/no) field bound to
    >>>>>>> a checkbox. This would save real estate on your form and would
    >>>>>>> probably make the user interface more intuitive.
    >>>>>>> --
    >>>>>>> Good Luck!
    >>>>>>>
    >>>>>>> Graham Mandeno [Access MVP]
    >>>>>>> Auckland, New Zealand - Torbay :)
    >>>>>>>
    >>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>> news:e654c7$68k$1@lust.ihug.co.nz...
    >>>>>>>> Graham I have a form that has a combo Box that has 2 options
    >>>>>>>> (Active & Finished)cbStatus, and another combo box that list
    >>>>>>>> clients, is possible to lock The clients Combo Box cbOwnerID when
    >>>>>>>> it is in active mode and unlock when in finished mode
    >>>>>>>> Thanks Bob (Papakura)
    >>>>>>>>
    >>>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>>> news:e653th$57p$1@lust.ihug.co.nz...
    >>>>>>>>> Thanx Graham got it now!
    >>>>>>>>>
    >>>>>>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>>>>>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>>>>>>>> Hi Bob (fellow Kiwi? :)
    >>>>>>>>>>
    >>>>>>>>>> The default MsgBox has only one button - "OK". If you want to
    >>>>>>>>>> give the user a choice you need at least two buttons.
    >>>>>>>>>>
    >>>>>>>>>> The second argument for MsgBox allows you to specify options such
    >>>>>>>>>> as the buttons to show and the icon to display.
    >>>>>>>>>>
    >>>>>>>>>> For example, you could say:
    >>>>>>>>>>
    >>>>>>>>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion)
    >>>>>>>>>> = vbYes Then
    >>>>>>>>>>
    >>>>>>>>>> This will display Yes and No buttons and a question mark icon.
    >>>>>>>>>> The function will return the value vbYes only if the "Yes" button
    >>>>>>>>>> was clicked.
    >>>>>>>>>>
    >>>>>>>>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>>>>>>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>>>>>>>
    >>>>>>>>>> Also, it is not incorrect, but it is most unusual to enclose your
    >>>>>>>>>> entire procedure body in an If...EndIf block.
    >>>>>>>>>>
    >>>>>>>>>> You should change this to:
    >>>>>>>>>>
    >>>>>>>>>> On Error ...
    >>>>>>>>>> If MsgBox ... Then
    >>>>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>>> End If
    >>>>>>>>>>
    >>>>>>>>>> --
    >>>>>>>>>> Good Luck!
    >>>>>>>>>>
    >>>>>>>>>> Graham Mandeno [Access MVP]
    >>>>>>>>>> Auckland, New Zealand
    >>>>>>>>>>
    >>>>>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>>>>> news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>>>>>>>> After the MsgBox line I must be missing something for it to
    >>>>>>>>>>> work, and can I change "Yes" to "Ok"
    >>>>>>>>>>>
    >>>>>>>>>>> Private Sub Command98_Click()
    >>>>>>>>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>>>>>>>> On Error GoTo Err_Command98_Click
    >>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>>>>
    >>>>>>>>>>> Exit_Command98_Click:
    >>>>>>>>>>> Exit Sub
    >>>>>>>>>>>
    >>>>>>>>>>> Err_Command98_Click:
    >>>>>>>>>>> MsgBox Err.Description
    >>>>>>>>>>> Resume Exit_Command98_Click
    >>>>>>>>>>> End If
    >>>>>>>>>>>
    >>>>>>>>>>> End Sub
    >>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>> Thanks in advance.........Bob Vance
    >>>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
  17. Bob

    Bob
    Expand Collapse
    Guest

    Sorry Graham I am going to give on this just getting over my head, thanks
    for the help....Bob

    "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    news:OR5drRnjGHA.4504@TK2MSFTNGP03.phx.gbl...
    > But did you add that field to your table first? And is it included in
    > your record source?
    >
    > --
    > Graham Mandeno [Access MVP]
    > Auckland, New Zealand
    >
    > "Bob" <xxx@xx.xx> wrote in message news:e6kqio$c0q$1@lust.ihug.co.nz...
    >>I got a compile error on Finished , member not found
    >> Thanks..Bob
    >>
    >> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >> news:ORxP%23jgjGHA.4504@TK2MSFTNGP05.phx.gbl...
    >>> So, your Form_Current event proc is already doing something (i.e.
    >>> calling the Sub named "subShowvalues")
    >>>
    >>> No matter - you want it to also do something else, so add your line of
    >>> code after that one.
    >>> --
    >>> Good Luck!
    >>>
    >>> Graham Mandeno [Access MVP]
    >>> Auckland, New Zealand
    >>>
    >>> "Bob" <xxx@xx.xx> wrote in message news:e6iv66$mc$1@lust.ihug.co.nz...
    >>>> Graham this is what is in there:
    >>>> Private Sub Form_Current()
    >>>> subShowValues
    >>>> End Sub
    >>>>
    >>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>> news:u9xbCrdjGHA.4344@TK2MSFTNGP05.phx.gbl...
    >>>>> Hi Bob
    >>>>>
    >>>>> With the form open in design view and the properties window displayed
    >>>>> (View>Properties), select the form (click the grey square in the top
    >>>>> left, or use Ctrl-R). Now, in the properties window, on the Event
    >>>>> tab, scroll down until you see "On Current". Type a
    >>>>> left-square-bracket "[" in the cell and "[Event Procedure]" should
    >>>>> appear. Then click the three dots button to the right of the cell.
    >>>>> The VBA code window should open showing (among other things):
    >>>>>
    >>>>> Private Sub Form_Current()
    >>>>> | <<< cursor is here
    >>>>> End Sub
    >>>>>
    >>>>> This is the event procedure for your form's Current event. That's
    >>>>> where the code goes.
    >>>>>
    >>>>> What I meant about a boolean field was to have a yes/no field in your
    >>>>> table named "Finished". You can then bind this to a checkbox on your
    >>>>> form and a single click will put a tick in the box (Finished) or clear
    >>>>> it (Active).
    >>>>>
    >>>>> Your code below would then change to:
    >>>>>
    >>>>> cbOwnerID.Locked = Me.Finished
    >>>>>
    >>>>> BTW, I know horses are pretty important in your neck of the woods, but
    >>>>> they have clients???
    >>>>> --
    >>>>> Good Luck!
    >>>>>
    >>>>> Graham Mandeno [Access MVP]
    >>>>> Auckland, New Zealand
    >>>>>
    >>>>>
    >>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>> news:e6ft15$ctt$1@lust.ihug.co.nz...
    >>>>>> Could not find this:
    >>>>>> AND
    >>>>>> in the Current event for your form, add the following code:
    >>>>>> Thanx..Bob
    >>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>> news:e6fs5l$b80$1@lust.ihug.co.nz...
    >>>>>>> No Graham just has the two (Active,Finished), should this be done
    >>>>>>> another way?.....Regards Bob Vance
    >>>>>>>
    >>>>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>>>> news:%23cEO$3NjGHA.412@TK2MSFTNGP05.phx.gbl...
    >>>>>>>> Hi Bob
    >>>>>>>>
    >>>>>>>> Sorry, I've been away for a few days.
    >>>>>>>>
    >>>>>>>> Yes, this is certainly possible. In the AfterUpdate event for
    >>>>>>>> cbStatus, AND in the Current event for your form, add the following
    >>>>>>>> code:
    >>>>>>>>
    >>>>>>>> cbOwnerID.Locked = (cbStatus = "Finished")
    >>>>>>>>
    >>>>>>>> Does Status have any options other than "Active" and "Finished"?
    >>>>>>>> If not, you might consider making it a boolean (yes/no) field bound
    >>>>>>>> to a checkbox. This would save real estate on your form and would
    >>>>>>>> probably make the user interface more intuitive.
    >>>>>>>> --
    >>>>>>>> Good Luck!
    >>>>>>>>
    >>>>>>>> Graham Mandeno [Access MVP]
    >>>>>>>> Auckland, New Zealand - Torbay :)
    >>>>>>>>
    >>>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>>> news:e654c7$68k$1@lust.ihug.co.nz...
    >>>>>>>>> Graham I have a form that has a combo Box that has 2 options
    >>>>>>>>> (Active & Finished)cbStatus, and another combo box that list
    >>>>>>>>> clients, is possible to lock The clients Combo Box cbOwnerID when
    >>>>>>>>> it is in active mode and unlock when in finished mode
    >>>>>>>>> Thanks Bob (Papakura)
    >>>>>>>>>
    >>>>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>>>> news:e653th$57p$1@lust.ihug.co.nz...
    >>>>>>>>>> Thanx Graham got it now!
    >>>>>>>>>>
    >>>>>>>>>> "Graham Mandeno" <Graham.Mandeno@nomail.please> wrote in message
    >>>>>>>>>> news:%23Wycn%23PiGHA.3296@TK2MSFTNGP05.phx.gbl...
    >>>>>>>>>>> Hi Bob (fellow Kiwi? :)
    >>>>>>>>>>>
    >>>>>>>>>>> The default MsgBox has only one button - "OK". If you want to
    >>>>>>>>>>> give the user a choice you need at least two buttons.
    >>>>>>>>>>>
    >>>>>>>>>>> The second argument for MsgBox allows you to specify options
    >>>>>>>>>>> such as the buttons to show and the icon to display.
    >>>>>>>>>>>
    >>>>>>>>>>> For example, you could say:
    >>>>>>>>>>>
    >>>>>>>>>>> If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion)
    >>>>>>>>>>> = vbYes Then
    >>>>>>>>>>>
    >>>>>>>>>>> This will display Yes and No buttons and a question mark icon.
    >>>>>>>>>>> The function will return the value vbYes only if the "Yes"
    >>>>>>>>>>> button was clicked.
    >>>>>>>>>>>
    >>>>>>>>>>> As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
    >>>>>>>>>>> vbAbortRetryCancel (the latter two have three buttons).
    >>>>>>>>>>>
    >>>>>>>>>>> Also, it is not incorrect, but it is most unusual to enclose
    >>>>>>>>>>> your entire procedure body in an If...EndIf block.
    >>>>>>>>>>>
    >>>>>>>>>>> You should change this to:
    >>>>>>>>>>>
    >>>>>>>>>>> On Error ...
    >>>>>>>>>>> If MsgBox ... Then
    >>>>>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>>>> End If
    >>>>>>>>>>>
    >>>>>>>>>>> --
    >>>>>>>>>>> Good Luck!
    >>>>>>>>>>>
    >>>>>>>>>>> Graham Mandeno [Access MVP]
    >>>>>>>>>>> Auckland, New Zealand
    >>>>>>>>>>>
    >>>>>>>>>>> "Bob" <xxx@xx.xx> wrote in message
    >>>>>>>>>>> news:e62gh1$dq9$1@lust.ihug.co.nz...
    >>>>>>>>>>>> After the MsgBox line I must be missing something for it to
    >>>>>>>>>>>> work, and can I change "Yes" to "Ok"
    >>>>>>>>>>>>
    >>>>>>>>>>>> Private Sub Command98_Click()
    >>>>>>>>>>>> If MsgBox("Does this horse have a Client") = vbYes Then
    >>>>>>>>>>>> On Error GoTo Err_Command98_Click
    >>>>>>>>>>>>
    >>>>>>>>>>>>
    >>>>>>>>>>>> DoCmd.GoToRecord , , acNewRec
    >>>>>>>>>>>>
    >>>>>>>>>>>> Exit_Command98_Click:
    >>>>>>>>>>>> Exit Sub
    >>>>>>>>>>>>
    >>>>>>>>>>>> Err_Command98_Click:
    >>>>>>>>>>>> MsgBox Err.Description
    >>>>>>>>>>>> Resume Exit_Command98_Click
    >>>>>>>>>>>> End If
    >>>>>>>>>>>>
    >>>>>>>>>>>> End Sub
    >>>>>>>>>>>>
    >>>>>>>>>>>>
    >>>>>>>>>>>> Thanks in advance.........Bob Vance
    >>>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     

Share This Page