Hi All
I am trying to return information from a record to an unbound text box based on information in a bound text box. I have the procedure working perfectly in an Form_Current() when it is retrieving information from a table. When I try and replicate the code and base it on a query I get an error when it fails the "If rs.NoMatch = True" criteria.
The error says Invalid use of Null
Anyone have any ideas??
See the below code.
Code:
Dim rs As DAO.Recordset
Dim LastSerial As String
Set rs = CurrentDb.OpenRecordset("qry11OrderHistory", dbOpenSnapshot, dbReadOnly)
rs.FindLast "AccNo='" & Me.AccNo & "'"
LastSerial = DLookup("EndSerialNo", "qry11OrderHistory", "AccNo ='" & Me.AccNo.Value & "'")
If rs.NoMatch = True Then
MsgBox "No Details with that account no on file", vbInformation, "Oops"
Exit Sub
Else
Forms![frmApprove11]![txtSerialNo] = LastSerial
End If