Calculating number of days

neo007

New member
Local time
Today, 07:28
Joined
Aug 30, 2012
Messages
3
Hi,

I need to be able to show the number of days between a date in a table and now. I am using a query to display the details on a form but I need the number of days to show as an additional field. I am trying to use DateDiff but I keep getting a syntax error. This is the code I am using in the query
Expr1: ([DateDiff],'d',[DOB],[Date()])
Any help would be appreciated.
Thanks
 
Welcome to the forum,

You don't need to use Date Diff just use:

Date()-[DOB] as the Expression
 
Hi,

Thanks for the reply. I have used the code but am getting the error, The Visula Basic Module contains a syntax error.
Thanks
 
In what context are you using this in VBA rather than a query? Where is the result supposed to go?
 
Hi,

I was hoping to use a query to display the fields on a form and to use the result of the caclulation as an extra field on that form.
Thanks
 
Simply add a textbox on the form and place the control source to

=Date()-[DOB]
 
Expr1: DateDiff("d",[DOB],Date())

Should work
 

Users who are viewing this thread

Back
Top Bottom