Date Check with If Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am trying to write some code that will have Access close the current dbase
that is open as well as exit the application.

I need some code that basically says if today’s date in before May 1, 2005
do nothing if it is May 1, 2005 or later close every thing down. Would the
following statement accomplish this?

Function Datecheck()

If Date() >= “05/01/2005†Then
DoCmd.Quit
End If

End Function
 
Dates in VBA need to be delimited with # characters, not quotes.

Function Datecheck()

If Date() >= #05/01/2005# Then
DoCmd.Quit
End If

End Function
 
Thanks.

Douglas J. Steele said:
Dates in VBA need to be delimited with # characters, not quotes.

Function Datecheck()

If Date() >= #05/01/2005# Then
DoCmd.Quit
End If

End Function
 
I sure hope you have a "backdoor" in there somewhere.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

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