I'm on the home streach of my project and found that my "Reset for New Search" command button not working as desired. What should happen is that when the button is clicked a Event Procedure is run. That event procedure should clear the text boxes that are used for a search query that loads the results into a list box on that same form.
When clicked, all is cleared in the text boxes, and the list box is cleared but shows column seperator lines in 1st row only . After entering new search data (let's say box 2 of the 3 boxes, and the search data is on the table) the "Search" button is clicked, the list box clears completely and nothing showing.
What I discovered is if I enter something in all 3 text boxes (say x, x, x) and click "Search" nothing happens, and then go back and delete 1st box, enter valid data in 2nd, delete 3rd and click the "Search" button again, the list box get populated like it should of after clearning the 1st search.
I can change any of the text box values and click "Search" not using the clear button, and that works loading new rows in that list box. Just the clear before a new search has problems.
Here is the code for the clear button click:
Private Sub clearButton_Click()
On Error GoTo Err_clearButton_Click
' clear the 3 text boxes, list box so that another search/query can be done
Me.WhatLastName.Value = ""
Me.WhatFirstName.Value = ""
Me.WhatMedRecNo.Value = ""
Me.SelectPrintItems.RowSource = ""
Me.Refresh
Exit_clearButton_Click:
Exit Sub
and here is the code for the search button click:
Private Sub SearchQuery_Click()
On Error GoTo Err_SearchQuery_Click
'Error checking to make sure user entered values for Last Name and First Name.
If Nz(Me.WhatLastName, "") & _
Nz(Me.WhatFirstName, "") & _
Nz(Me.WhatMedRecNo, "") = "" Then
MsgBox ("Please enter a Search value, all 3 may not be blank")
GoTo Exit_SearchQuery_Click
Else
Me.SelectPrintItems.RowSource = "Lukup_Query"
Me.SelectPrintItems.Requery
End If
Exit_SearchQuery_Click:
Exit Sub
The Lukup_Query is just a Select using the What... fields above in a WHERE statement to select for populating the list box.
Should work but I must be overlooking something that is obvious