Error Handling

  • Thread starter Thread starter bw
  • Start date Start date
B

bw

Me![Calendar1].Value = CDate(TheDate)

If "TheDate" is not a valid date, i.e. 00/00/04, how do I keep this code from giving me an
error? Or can I perform some check on "TheDate" to make sure it's "legal" before this
code?

Thanks,
Bernie
 
One way:

If IsDate(TheDate) Then
Me![Calendar1].Value = TheDate
Else
MsgBox "Enter a valid date"
End If
 
Thank you both, Chris and JE.

I should have known this...
Bernie


One way:

If IsDate(TheDate) Then
Me![Calendar1].Value = TheDate
Else
MsgBox "Enter a valid date"
End If


bw <[email protected]> said:
Me![Calendar1].Value = CDate(TheDate)

If "TheDate" is not a valid date, i.e. 00/00/04, how do I keep this code from
giving me an
error? Or can I perform some check on "TheDate" to make sure it's "legal"
before this
code?

Thanks,
Bernie
 

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

Back
Top