Error when checking field for data

D

decc

I'm having an intermittent problem with checking for data in a cell. I
get a type mismatch error but the occurrance of the error is rare. My
goal is to require the user to enter a date in a particular cell. The
contents of this cell are then propogated to corresponding cells on
pages 2 and 3 of my form.

In my setup module I have a variable defined as a range and set to the
cell I want to check.

Public objDateReqd As Range
Set objDateReqd = Range("H15")

In my Process module I have the following if statement to check for
contents.

If objDateReqd = "" Then 'If "Date Req'd" cell is blank,
display error message
MsgBox "Please enter the date required in the appropriate
field." & Chr(13) & _
"A value of 'ASAP' is acceptable however a specific date
" & Chr(13) & _
"is more valuable", , "Incomplete Form Error"
objDateReqd.Select
strEntryError = "Y" 'Set Entry Error flag to "Y"
Exit Sub
End If

When the type mismatch error occurs it does so on the "If..." line.
Again, the error seldomly occurs but it does so just often enough to be
annoying. Anyone have any thoughts on what might be going on?

BrianG
 
R

Rowan Drummond

One guess, try changing
If objDateReqd = "" Then
to
If objDateReqd.Value = "" Then

Hope this helps
Rowan
 

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