I have the following code attached to a submit button on my form with just one unbound field "projectid". I need to add an error message when the projectid entered does not exist in the database. What I have tried is not working so far and would appreciate some help with the code.
Private Sub Command3_Click()
If Not IsNull(Me.projectid) Then
strWhere = " (tblProjectDetails.projectid) = " & Me.projectid
End If
---section not working----
If Me.projectid <> (tblProjectDetails.projectid) Then
MsgBox "There is no project in the database with the ID number entered.", vbExclamation, "Error"
Cancel = True
------End If ------
DoCmd.OpenForm "Projects", , , strWhere
End Sub
Thanks!
Private Sub Command3_Click()
If Not IsNull(Me.projectid) Then
strWhere = " (tblProjectDetails.projectid) = " & Me.projectid
End If
---section not working----
If Me.projectid <> (tblProjectDetails.projectid) Then
MsgBox "There is no project in the database with the ID number entered.", vbExclamation, "Error"
Cancel = True
------End If ------
DoCmd.OpenForm "Projects", , , strWhere
End Sub
Thanks!