Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Kitchener, Ontario, Canada
    Posts
    228
    Thanks
    0
    Thanked 0 Times in 0 Posts

    updating query (xp)

    I have a drop down in a table which is base on a query. Then on a form I have a subform with this table.
    When I open the record the query works fine but when I switcg records the query is still showing the info from the first record.

    I think it has something to do with the dirty event. I am guessing this should be set so when I open the tab but how is the question.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: updating query (xp)

    Is this in any way related to your previous question with the same subject?

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Kitchener, Ontario, Canada
    Posts
    228
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: updating query (xp)

    Nope... That one is figured out. This is a different one where it works the fist time I try to use the drop dows but when I change records the drop downs still have the same info.... the drop downs are built off of querys.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: updating query (xp)

    You haven't provided enough information.

  5. #5
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Kitchener, Ontario, Canada
    Posts
    228
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: updating query (xp)

    Sorry,

    form with tabs on one tab is a subform
    subfom has drop downs which arew linked to querys


    when I open record 1 the dropdown has the information for record 1
    when I change to record 2 the dropdown still have the info for record 1
    if I close the form and opened it again and go to record 2 before I go to the subform I get the dropdown for the 2nd record

    it is like the subform is not getting the changes when the record changes. I was guessing this had something to do with the dirty command...

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: updating query (xp)

    You should requery the combo boxes in the On Current event of the subform.

  7. #7
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Kitchener, Ontario, Canada
    Posts
    228
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: updating query (xp)

    How would I do that...

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: updating query (xp)

    Something like

    Private Sub Form_Current()
    Me.ComboBox1.Requery
    Me.ComboBox2.Requery
    End Sub

    where ComboBox1 and ComboBox2 are the names of the combo boxes (dropdowns). You can add/remove lines as needed for your situation.

  9. #9
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Kitchener, Ontario, Canada
    Posts
    228
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: updating query (xp)

    This will go where... on the VB for the subform?

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: updating query (xp)

    Yes, since you want to requery combo boxes on the subform, you should use the On Current event of the subform. The code for the On Current event of the subform belongs in the code module of the subform.

Posting Permissions

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