I have a listbox on the main menu form and the record source for the listbox is a query. I also have a textbox on the main menu form where the user can type in a part number and click on a search button. The search button has this line in it:
and it finds the part number with the query. IN the query, the criteria is:
[forms]![deviation_main_menu]![part_Base_Dev_No] which in the name of the textbox on the main menu.
All of this works fine while you are in the form. I have an Exit Button that closes the main menu form. When I click on the Exit button, I get a box:
Enter Parameter Value:
okay button and cancel button.
why not try setting the list box's rowsource with vba rather than you paramiter query. you could have a simple query be the list box's default rowsource ie. SELECT partnumber, part FROM tablename;. then on the text box's on after update event add set the row source to a new query, using the text box's value.
this code should work:
Private Sub TextBox_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT partnumber,part FROM tablename WHERE partnumber" & _
"= '" & TextBox & "' ;"
.RowSource = strSQL
Thanks for your ideas. I finally found the problem. I have a form that I open when the application loads called Main Form. I maximize it to hide the tables, queries, modules, etc. For some reason when I would leave that form open and open the Deviation form, if a search was performed and the query was accessed, the Exit procedure would cause the parameter value pop up. What I ended up doing was closing the main form when I open the Deviation form and then open the main form back up when exiting the Deviation form. It also seem to matter which event I maximized the forms in. I don't understand it, but I'm glad it's fixed.