No problem, the help is greatly appreciated. All the information except the date field is stored in one table. The two tables are linked through an autonumber ID.
Thank you for taking the time to help me.
No prob. I hope that I can. Anyway, in the code below I am searching for individuals by first AND last name OR by first name only or last name only. It then opens another form and the queried data is displayed on the newly opened form. I believe that it what you are doing with your data. Because you are using more criteria, it may be a bit more lengthy but this logic does work.
Options
1.You may want to consider using additional command buttons to narrow the criteria. For example, search by product ID and date or Model and Name brand...etc.
2. Another way that may help is to limit the search criteria to return more rows and let the user pick from that queried set.
3. In your code, check first to see if the fields are blank or not. Assign the textbox and combobox values to a variable(s) in the code. Which ever field is blank, assign a min/max value to that variable to return all rows. For example,
If !forms!frmGetData!textbox.ModelName = " " then
myVariableForModelName = "ZZZZZZZZZZ"
EndIf
Then execute your query after assigning all the blank form fields a value.
Hope This helps. Let me know.
----------------------------------------------------
Heres the code
Private Sub cmdSubmitINQ_Click()
On Error GoTo Err_cmdSubmitINQ_Click
'This procedure queries the for hire drivers based on their name
Dim stDocName As String
Dim stLinkCriteria As String
Dim strsql As String
Dim dbsn As Database
Dim NameFirst As String
Dim NameLast As String
NameFirst = Me!txtFHfirst & " "
NameFirst = "'" & NameFirst & "'" <----Single quote between two double quotes
NameLast = Me!txtFHlast & " "
NameLast = "'" & NameLast & "'" <----Single quote between two double quotes
Set dbsn = CurrentDb
strsql = "Select fname, lname, dob,fhNumber into LookupFH"
strsql = strsql & " From tblForHirePersonal"
strsql = strsql & " Where tblForHirePersonal.fname= " & NameFirst
strsql = strsql & "
or tblForHirePersonal.lname= " & NameLast
dbsn.Execute strsql
DoCmd.Close
stDocName = "frmForHirePick"
DoCmd.OpenForm stDocName, , , stLinkCriteria