Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Conversion / August 2005

Tip: Looking for answers? Try searching our database.

Format function in Ms Access 97

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
chetna k - 18 Aug 2005 10:36 GMT
I am in trouble in comparing two dates:

as I wrote code as

If (Format(Me![Delivery Timescales], "short date") < Format(Now(), "short
date")) Then
                   MsgBox "Please enter Requested Start date as current date
or any future date", vbCritical
End If

where [Delivery Timescales] is a Text Box and the whole code has been written
on the click of a button.

The Error I am getting is the If condition is coming false as I entered
31/12/2004 in [Delivery Timescales] text box.

Can anybody help?

Thanks in advance.
Allen Browne - 18 Aug 2005 11:50 GMT
Drop the Format() part. Access knows how to compare two dates. You are
forcing it to perform a *string* comparision rather than a date comparison
when you use the Format() function.

Since your dates as d/m/y, take a look at this article:
   International Date Formats in Access
at:
   http://allenbrowne.com/ser-36.html
It explains how to ensure Access always understands your dates correctly.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I am in trouble in comparing two dates:
>
[quoted text clipped - 13 lines]
> The Error I am getting is the If condition is coming false as I entered
> 31/12/2004 in [Delivery Timescales] text box.
chetna k - 31 Aug 2005 15:38 GMT
Thanks for your help.

I used now CDATE function to compare dates and it is working fine.

Thanks
Chetna

>I am in trouble in comparing two dates:
>
[quoted text clipped - 15 lines]
>
>Thanks in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.