Maybe you should post the SQL of your query ...
/gustav
Main Topics
Browse All TopicsHow can I convert a query to reference a date in a form? If I enter a static date as #09/30/2009# my query returns expected results. When I try to create a popup by entering [Date] in my qurey or have it reference my form - [Forms]
Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
LPD: DateDiff ("d", [Forms]![frmGenerateSummar
Avoid math operations directly on dates unless you are sure what the dates will be and you really know what you are doing.
About dotes in Access:
Access stores all dates as doubles as the number of days since 12/30/1899 12:00:00 AM (Format(0,"mm/dd/yyyy hh:nn:ss AM/PM") = 12/30/1899 12:00:00 AM). For example 09/11/2005 10:56:40 AM is stored as 38606.4560185185 or 38606.4560185185 days since 12/30/1899 12:00:00 AM (CDbl(#09/11/2005 10:56:40 AM#) = 38606.4560185185). You can input and display the date/time in any format you choose.
Time without a date will default to 12/30/1899 since the integer portion of the double is zero.
Date without a time will default to Midnight since the fractional portion of the double is zero.
DateDiff does not give fractional time periods so if you want hours plus fraction use:
DateDiff("n",Date1,Date2)/
if you want hours and minutes use:
Format(DateDiff("n",Date1,
Also keep in mind that Access is an American product so VBA is sometimes expecting mm/dd/yyyy even when the regional setting is set for something else. yyyy/mm/dd will always work for VBA input.
Hi
The # posted above should work...You can also try cdbl() function which seems to work for me which I use for all date related stuff (fields,forms etc). and avoids UK/USA date issues I get very often! But that is only my prefernce I don't think is common use.
It is usually a good idea to use datediff function as well to avoid issues with Date + time (or now() function)
Regards
Emil
Thanks so much. You really know your stuff.
What I have to do is calculate how many days since the last payment. and Last Payment Date is in my table...
When I enter LPD: DateDiff ("d", [Forms]![frmGenerateSummar
Business Accounts
Answer for Membership
by: thenelsonPosted on 2009-10-31 at 10:26:29ID: 25710561
You still need the pound signs so: yReport]![ EnterDate] & "#"
"#" & [Forms]![frmGenerateSummar
Vba data type-declaration characters:
Number (base 10): No type-declaration character needed (the number will automatically be converted to the type needed)
example: 1234, 67.77
Required data type-declaration characters:
String: Bracket with quotation marks or apostrophes (required)
example: "This is a string" or 'this is a string'
date/time: Bracket with pound signs (required)
example: #6/1/1947#, #June 17, 1999#, #3:30Pm#, #1/5/63 2:33#
Hexadecimal number: Precede with &h
example: &H10
0ctal number: Precede with &o
example: &O10
optional, explicitly specified data type-declaration characters:
Integer: Append with percent sign
example: 1234%
Long: Append with ampersand
example: 67877768&
Currency: Append with at sign
example: 62.45@
Single: Append with exclamation point
example: 123.777!, 67.00!
Double: Append with number sign
example: 677767.8888#