Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forbid opening a second combo box if first isnt op (Access 2000)

    How to Forbid opening a second combo box if first isnt opened ?
    I have 2 combo boxes: clientid and employeeid.On opening the form first i go directly to the
    first combo box through the code:
    DoCmd.GoToRecord , , acNewRec
    Clientid.SetFocus

    However sometimes i may want to open the combo box Employeeid by itself and i want to forbid it.
    I want to allow opening the combo box employeid only when i have selected a client in the first combo box,
    and give the message"please select a client first"
    I have tried the following

    If Me![Clientid] = "" Then
    MsgBox " Please select a client first"
    Exit Sub
    End If


    But the code does not function and i see i have some mistaked in my code.May i have some help?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Forbid opening a second combo box if first isnt op (Access 2000)

    What event are you running the error message code? It should probably be on GotFocus. Another way to do this is to either make the employeeid locked, or not visible, until a client is selected in the clientid combo. On the AfterUpdate event for clientid you could then unlock or make visible the employeeid combo. I think your approach is probably better however, as someone could select a client, and then delete it. I also would suggest checking for Null as well as an empty string. Hope this helps.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •