Results 1 to 4 of 4

Thread: popup

  1. #1
    Join Date
    Jul 2004
    Posts
    214

    Unanswered: popup

    All. I have a cmd button on a form that when the users click, they get a message box to enter some criteria. The buttons record source is a query. How can I get it so when the user click the button instead of the message box to enter data, they get a drop down box to choose criteria? I know that I can create a combo box on the form and put code behind the button but I'm trying to eliminate too many boxes.
    Thanks

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sorry, but Your post isn't very clear. Buttons don't have Record Sources and you can't enter anything in MessageBoxes!

    "...they get a drop down box to choose criteria...I know that I can create a combo box on the form and put code behind the button but I'm trying to eliminate too many boxes."

    Well, since a "dropdown box" and a *combobox* are the same thing, it's going to be tough! If you're concerned about the combobox taking up too much space on your form, only show it when the user needs it to select the criteria, I assume for the query you mentioned.

    Setup your combobox; in the properties box set the Visible property to No.
    Behind the button you mentioned, use this code:

    Code:
    Private Sub YourCommandButton_Click()
      MyComboBoxName.Visible = True 'makes the box visible
    End Sub
    Your user can now select the needed criteria.

    Do whatever else you have to, running a query by the sounds of it.

    Then, to make your combobox invisible again:

    Code:
    Private Sub ComboBoxName_AfterUpdate()
      SomeOtherControl.SetFocus  'set focus to any control other than your combobox
      ComboBoxName.Visible = False  'make the combobox invisible again
    End Sub
    The SomeOtherControl can be any control on your form that can have focus. You have to do this because you cannot make a control, such as your combobox, invisible when it has focus.
    Good Luck!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jul 2004
    Posts
    214
    Thanks sorry I wasn't clear. It was too early in th morning. But this helps

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad I could help! Give it a whirl, and if you run into problems, let us know!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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