Text box woe

tweetyksc

Registered User.
Local time
Today, 12:12
Joined
Aug 23, 2001
Messages
87
Again, something simple tripping me up, or maybe I'm just brain dead.

I have a text box on a form to filter the underlying query for a report when that report is selected to be run. I want to display a message if the field is blank. I've done this with combo boxes, etc. but with this I keep getting "type mismatch" when I try to test with the field blank.

Here's the code:
---------------------------
Case 9
Me.txtLastDate.SetFocus
If Me.txtLastDate.Text = "" Then
MsgBox "Please enter a date", "Slow Moving Inventory,vbOKOnly"
Exit Sub
Else
stDocName = "Slow Moving Inventory"
End If
----------------------------
 
Rich said:
If Not IsDate(Me.txtLastDate) Then

Thanks Rich; I tried but still getting a type mismatch error. Don't know why.

If I put a number in the field (i.e. 457) I will get the standard error that the value entered isn't valid, but if I leave it blank I get a type mismatch.
This is a text box on a form formatted as date.
The query field is a date field, naturally.
Any ideas?
 

Users who are viewing this thread

Back
Top Bottom