I have two forms which are linked via the primary key ([Control#]. Users enter a Received Date in the main form and then later enter the Date Closed into the linked form. The main form is called LogBatch1 and the linked form is called frmCloseBatch. I'm trying to enter validation criteria in the Close Batch form to prevent users from entering a date that preceeds the date the batch was received. I wrote some code in the Before Update event of the frmCloseBatch - but I'm getting an error message "Application-defined or Object-defined error" (error 2465).
Here's the code:
Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte
If CDate (DateClosed) < Form.LogBatch1.txtDateReceived then
strMessage = "....blah blah blah"
intOptions = vbOKCancel
bytChoice = MsgBox (strMessage, intOptions, "Invalid Date")
DateClosed.SetFocus
Cancel = True
End If
End Sub
Any suggestions...I'm really stumped!!!
Here's the code:
Dim strMessage As String
Dim intOptions As Integer
Dim bytChoice As Byte
If CDate (DateClosed) < Form.LogBatch1.txtDateReceived then
strMessage = "....blah blah blah"
intOptions = vbOKCancel
bytChoice = MsgBox (strMessage, intOptions, "Invalid Date")
DateClosed.SetFocus
Cancel = True
End If
End Sub
Any suggestions...I'm really stumped!!!