Your frmAdpEdit record source will be a query. The Query will contain references to the txt boxes on you form i.e. Code:
Like [Forms]![UnboundForm]![ANumberTxt1] & "*"
Full example based on the info you provided,
Code:
SELECT DataTable.ANumb, DataTable.ID2Number, DataTable.LastName, DataTable.DateOfBirth
FROM DataTable
WHERE (((DataTable.ANumb) Like [Forms]![UnboundForm]![ANumberTxt1] & "*") AND ((DataTable.ID2Number) Like [Forms]![UnboundForm]![txtID2Number] & "*") AND ((DataTable.LastName) Like [Forms]![UnboundForm]![txtLastName] & "*") AND ((DataTable.DateOfBirth) Like [Forms]![UnboundForm]![txtDateOfBirth] & "*"));
Your form command button will then read the results of this query when opening the frmAdpEdit
From the VBA you provided a effective sollution is as follows,
Notice i am not inlcuding DOB in the first Null statement, also note i am using "AND"
Code:
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(ANumberTxt1) And IsNull(txtID2Number) And IsNull(txtLastName) Then
MsgBox "Please Enter More Search Criteria"
Me.ANumberTxt1.SetFocus
Exit Sub
Else
stDocName = "frmAdpEdit"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
If IsNull(Forms!frmAdpEdit!ANumb) Then
DoCmd.Close acForm, "frmAdpEdit"
MsgBox "Recod Does Not Exist"
End If
This simply make a DOB seach on its own move to the MsgBox and Exit the sub.
I have attached an example to help.
Regards AOG
Bookmarks