Type Mismatch generated by code.

M

martinmike2

Hello,

I am recieveing a type mismatch error when I run this code:

Private Sub cmdEOUT_Click()
On Error GoTo Err_cmdEOUT_Click

Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(CHECK_OUT_DATE Or TRANSFERED_TO Or Text566) = True Then
If IsNull(CHECK_OUT_DATE) = True Then
Me.CHECK_OUT_DATE.BackColor = 26367
End If
If IsNull(TRANSFERED_TO) = True Then
Me.TRANSFERED_TO.BackColor = 26367
End If
If IsNull(Text566) = True Then
Me.Text566.BackColor = 26367
End If
MsgBox "You must complete the highlighted fields to" & vbCrLf & _
"successfuly print a check-out sheet.", vbOKOnly +
vbInformation + vbExclamation, gstrAppTitle
Else
stDocName = "frmECHKOUT"
DoCmd.OpenForm stDocName
End If
Exit_cmdEOUT_Click:
Exit Sub

Err_cmdEOUT_Click:
MsgBox Err.Description
Resume Exit_cmdEOUT_Click

End Sub




the code works when all of the boxes are empty, but when one, two, or
all three of them are dirty then I get a type mismatch error.
 
D

Douglas J. Steele

Try changing

If IsNull(CHECK_OUT_DATE Or TRANSFERED_TO Or Text566) = True Then

to

If (IsNull(CHECK_OUT_DATE) Or IsNull(TRANSFERED_TO) Or IsNull(Text566)) =
True Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top