Hi everyone,
The following code produces an "Invalid use of Null" message.(Access 2000) I am trying to test if the strUserInput matches a value in the ORI field of tblValidationListMaster. If it does I want to set MailFlag by running strSQL; if the strUserInput is not found as a value in the ORI column then I need to notify the user. Your help would be greatly appreciated.
The following code produces an "Invalid use of Null" message.(Access 2000) I am trying to test if the strUserInput matches a value in the ORI field of tblValidationListMaster. If it does I want to set MailFlag by running strSQL; if the strUserInput is not found as a value in the ORI column then I need to notify the user. Your help would be greatly appreciated.
Code:
Private Sub cmdFindByORI_Click()
On Error GoTo Err_cmdFindORI_Click
Dim strUserInput As String
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblValidationListMaster", dbOpenDynaset)
Do
strUserInput = InputBox("Enter ORI or QUIT")
With rs
.FindFirst ORI = strUserInput
If .NoMatch = True Then
MsgBox ("That ORI is not in table tblValidationListMaster")
Else
strSQL = "UPDATE tblValidationListMaster SET MailFlag = True WHERE ORI = "
strSQL = strSQL + "'" + strUserInput + "';"
Debug.Print strSQL
DoCmd.RunSQL strSQL
DoCmd.RunCommand acCmdSaveRecord
End If
End With
Loop While strUserInput <> "Quit"
rs.Close
Exit_cmdFindORI_Click:
Set rs = Nothing
Set db = Nothing
Exit Sub
Err_cmdFindORI_Click:
MsgBox Err.Description
Resume Exit_cmdFindORI_Click
End Sub
Last edited: