I have a form in a database format. The form is based on a query. I want the users to be able to select the parameter from a combo box, then have the form show the data based on the parameter selected. Here is what I have tried. I created a combo box in the form that is unbounded, it pulls from a table to get the list. In the afterupdate event I have the following code: (The credit for this code goes to Tranman)
What happens is the form opens, then after selecting from the combo the correct parameter, the query opens showing the correct data. But the Form does not update and if I close the form and open it again, it is now blank, no data in it at all.
What I want to happen, is the user does not see the query opening (if possible) and the form updates after the query runs, or if the parameter is in a seperate form, that the correct form opens after the query runs.
I also tried doing this with a click button, but I could not get the button to show up when the form was in database view.
C. Johnson
Code:
Private sub Combo91_afterupdate()
On Error GoTo Err_Combo91_afterupdate
Dim stDocName As String
stDocName = "Team 1New"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Combo91_afterupdate:
Exit Sub
Err_Combo91_afterupdate:
MsgBox Err.Description
Resume Exit_Combo91_afterupdate
End Sub
What happens is the form opens, then after selecting from the combo the correct parameter, the query opens showing the correct data. But the Form does not update and if I close the form and open it again, it is now blank, no data in it at all.
What I want to happen, is the user does not see the query opening (if possible) and the form updates after the query runs, or if the parameter is in a seperate form, that the correct form opens after the query runs.
I also tried doing this with a click button, but I could not get the button to show up when the form was in database view.
C. Johnson