I have a search form with a number of comboboxes. The user can select any option from as many comboboxes as they please to find the record(s) they want to track. It works fine on the first open - opens blank. It also works fine if you open, choose an option, but close the form. When you reopen the form all comboboxes are blank. My problem is this:
After a user has run a search and looked at the records they may want to run another search. If they ask for the same form again from the switchboard it opens with their previous choices.
This is the code I have:
I am guessing I need to insert a command to clear each individual combobox after the open form cmd and before the close form cmd. Would this involve seperate sub commands for each one?
I am thinking of something like this
How would I insert a command to run that in the middle of the code. Also, will I need to give focus back to my search form rather than my search results form?
After a user has run a search and looked at the records they may want to run another search. If they ask for the same form again from the switchboard it opens with their previous choices.
This is the code I have:
Private Sub OK_Click()
On Error GoTo Err_Command0_Click
Me.Visible = False
DoCmd.OpenForm "TPF", acViewNormal, acEdit
DoCmd.Close acForm, "Search"
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_Command0_Click
End Sub
I am guessing I need to insert a command to clear each individual combobox after the open form cmd and before the close form cmd. Would this involve seperate sub commands for each one?
I am thinking of something like this
Private Sub cmdClearCombo1_Click()
With Me.TPTrust
.Value = Null
End With
End Sub
How would I insert a command to run that in the middle of the code. Also, will I need to give focus back to my search form rather than my search results form?