Parameter query that launches twice

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • limperger
    New Member
    • Mar 2008
    • 66

    Parameter query that launches twice

    Hello everyone:

    First and foremost: I find this case below difficult to explain so let me hereby present my apologies if someone's willing to help but does not understand what is all this thing about...Just let me know and I will try to explain it better.
    I've got a form with a list box. The list box type is that in which the data for the record selected automatically appears in the form. The records (ctrl source) come from a parameter query, so that the records showing in the form are filtered via the parameter query.
    The problem is that the query launches twice: for the list box and for the form and the user is prompted to type the data twice. If only the first msgbox is filled, then only data for the list box appear; if it is the second msgbox the one filled, then the data appears for the form but the list box remains blank. If both msgboxs are filled, data appear for both the list box and the form. How do I manage to get only one msgbox appearing but getting data for both the list box and the form?

    Best regards!!
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by limperger
    Hello everyone:

    First and foremost: I find this case below difficult to explain so let me hereby present my apologies if someone's willing to help but does not understand what is all this thing about...Just let me know and I will try to explain it better.
    I've got a form with a list box. The list box type is that in which the data for the record selected automatically appears in the form. The records (ctrl source) come from a parameter query, so that the records showing in the form are filtered via the parameter query.
    The problem is that the query launches twice: for the list box and for the form and the user is prompted to type the data twice. If only the first msgbox is filled, then only data for the list box appear; if it is the second msgbox the one filled, then the data appears for the form but the list box remains blank. If both msgboxs are filled, data appear for both the list box and the form. How do I manage to get only one msgbox appearing but getting data for both the list box and the form?

    Best regards!!
    I believe your form query does not point back to the selection made in the listbox like it should. This is usually done in the AfterUpdate event of the listbox. to get a better understanding of what I am talking about, see the following link to a HowTo, step by step tutorial for a listbox search form with a downloadable demo mdb file.



    Note that although the example is slightly different in that the AfterUpdate event of the listbox is used to enable a button and the button click event is used to update the form, the principle is still the same ...the query that updates the form contains a parameter that has the selection made from the listbox as shown below:
    Code:
    "[tblSalespersonContact.strSalespersonID]=" & _
                       "'" & Me.lstSearch.Column(0) & "'"

    Comment

    Working...