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
 
Back
Top