Results 1 to 8 of 8

Thread: MS ACCESS: Open form from combo box selection

  1. #1
    Join Date
    Jan 2005
    Posts
    498
    Rep Power
    0

    Question MS ACCESS: Open form from combo box selection

    Yet another access question from me.
    So I have a combo box on a form that i want to use to open another form and filter that form with the value in the combo box. The combo is not bound to any table i just let it select the values from a query, it also has two fields in it.
    I tried using the "after_update" event but that doesn't work i guess because when i click something in the combo box, it is not selected, the list just stays open. The list is enabled and not locked.
    Anyone know what I am doing wrong?
    (I'm guessing its because its not bound?)
    Notorios
    That Which Is Not Defined Is Infinitely Great
    Google The Search Engine Of The Gods

  2. #2
    Join Date
    Feb 2005
    Posts
    85
    Rep Power
    0

    Default

    Quote Originally Posted by Notorios View Post
    Yet another access question from me.
    So I have a combo box on a form that i want to use to open another form and filter that form with the value in the combo box. The combo is not bound to any table i just let it select the values from a query, it also has two fields in it.
    I tried using the "after_update" event but that doesn't work i guess because when i click something in the combo box, it is not selected, the list just stays open. The list is enabled and not locked.
    Anyone know what I am doing wrong?
    (I'm guessing its because its not bound?)
    The after_update is fired However you need to set the form filter property to true. For example:

    Code:
     
    Private Sub cmbobox1_AfterUpdate()
    Forms![form1].FilterOn = True
    Forms![form1].Filter = cmbobox1
    MsgBox cmbobox1
    End Sub
    Last edited by ToxXxic; Aug 13, 2009 at 04:31 PM.
    Code King aka Code WizZzard: Motivated By The Challenge, Driven By The Will To Succeed.

    In The Land Of Programmers, The Code WizZzard Is KING. Sen on anything VB

  3. #3
    Join Date
    Feb 2005
    Posts
    85
    Rep Power
    0

    Default

    Please note that if the user types a value in the combo box then they will have to press the enter key or move to another field on the form in order for the "AfterUpdate" event to fire
    Code King aka Code WizZzard: Motivated By The Challenge, Driven By The Will To Succeed.

    In The Land Of Programmers, The Code WizZzard Is KING. Sen on anything VB

  4. #4
    Join Date
    Jan 2005
    Posts
    498
    Rep Power
    0

    Default

    I tried what you said with doubts in mind and it didn't work . I don't think the event is firing because i have a message box in there as the first thing and that doesn't pop when I click a member of the list.
    So the question is why is the event not firing?
    Notorios
    That Which Is Not Defined Is Infinitely Great
    Google The Search Engine Of The Gods

  5. #5
    Join Date
    Feb 2005
    Posts
    85
    Rep Power
    0

    Default

    Quote Originally Posted by Notorios View Post
    I tried what you said with doubts in mind and it didn't work . I don't think the event is firing because i have a message box in there as the first thing and that doesn't pop when I click a member of the list.
    So the question is why is the event not firing?

    PM me with your email address and I will send you a sample database to show you that it works

    Also if possible: send me a sample of the entire code on the form
    Last edited by ToxXxic; Aug 14, 2009 at 11:54 AM.
    Code King aka Code WizZzard: Motivated By The Challenge, Driven By The Will To Succeed.

    In The Land Of Programmers, The Code WizZzard Is KING. Sen on anything VB

  6. #6
    Join Date
    Feb 2005
    Posts
    85
    Rep Power
    0

    Default

    Did you rename the combo box? If you did then check to ensure that the combo box name is consistent with the name of the AfterUpdate event.
    Code King aka Code WizZzard: Motivated By The Challenge, Driven By The Will To Succeed.

    In The Land Of Programmers, The Code WizZzard Is KING. Sen on anything VB

  7. #7
    Join Date
    Jan 2005
    Posts
    498
    Rep Power
    0

    Default

    Tried what you sent toxxxic, yours ran fine, copied it to my db and it ran fine in there, compared and made changes still didn't work. Made a new one in another form and it worked, recreated in the original form, did not work. So i figure something must be wrong with that form so i think i will recreate that form and see what happens, nothing much on it anyway.
    Notorios
    That Which Is Not Defined Is Infinitely Great
    Google The Search Engine Of The Gods

  8. #8
    Join Date
    Jan 2005
    Posts
    498
    Rep Power
    0

    Default

    Decided to snoop around the form, found my problem, the form had the Property Allow Edits set to No, changed it to yes and smooth sailing. Thanks for the help.
    Notorios
    That Which Is Not Defined Is Infinitely Great
    Google The Search Engine Of The Gods

Posting Permissions

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