This is what I have.'
I call this in a click() event.
Code:
Private Sub Bank()
'This sub is to search the table workordertracking for the criteria that is in the drop down box
'This is the variable for the form to be opened and populated
Dim BnkDocName As String
'This is the variable for the matching strings
Dim BnkLinkCriteria As String
'This is to assign the form "SubSearch" to the variable stdocName
'This will be the form which will be populated with the information in the form
BnkDocName = "SubSearch"
'me.combo5 is the combo box that is controled by the table "Bank" in the properties for the combo5 box
If Not IsNull(Me.Combo5) Then
'This is how the literial strings are assigned to the variable which are matched from
'the field in the table and the combo box on the search form
BnkLinkCriteria = "[bank]=""" & Me!Combo5 & """"
End If
'This is the message box if the combo box is left empty
If IsNull(Me!Combo5) Then
MsgBox ("Please select a Bank from the drop down...")
Else
'This is the opening of the form and the criteria match
'When the form is opened it will be populated with the information from
'the controled source in each text box on the form
DoCmd.OpenForm BnkDocName, , , BnkLinkCriteria
End If
End Sub
Comment