R
Rob S
Hi,
I'm designing a report on which I need to calculate someones age based
on their birthdate. I don't know how to program in VB, so I was
borrowing code off of examples I found in this group, but everything I
try gives me a syntax error.
I have a field called TWINBDAT, which is a date/time field with the
short date format. I want to compare that to the current date to
calculate an age. I've tried a few of the different examples that
format answers for month and year and such, but get the same error for
everything I try. In its simplest form, the expression I am using is
DateDiff("yyyy", [TWINBDAT], #1/26/2005#())
In this example I just entered todays date since I really don't know
how to tell access to use the current days date. I tried 'now' but
since I always get an error message anyway, don't know of that works or
not, and figured I'd eliminate as many questionable things as I could.
The exact error message i get is "Syntax error (comma) in query
expression [DateDiff("yyyy", [TWINBDAT], #1/26/2005#())]
On the report, I inserted a bound object frame and am using the
expression in the data control source.
Any help on why this won't work would be greatly appreciated. I'm not
an Access expert by any stretch, but got shouldered with this task
because I know a bit more about databases in general than anyone else I
work with... Thanks for your help.
Rob S.
I'm designing a report on which I need to calculate someones age based
on their birthdate. I don't know how to program in VB, so I was
borrowing code off of examples I found in this group, but everything I
try gives me a syntax error.
I have a field called TWINBDAT, which is a date/time field with the
short date format. I want to compare that to the current date to
calculate an age. I've tried a few of the different examples that
format answers for month and year and such, but get the same error for
everything I try. In its simplest form, the expression I am using is
DateDiff("yyyy", [TWINBDAT], #1/26/2005#())
In this example I just entered todays date since I really don't know
how to tell access to use the current days date. I tried 'now' but
since I always get an error message anyway, don't know of that works or
not, and figured I'd eliminate as many questionable things as I could.
The exact error message i get is "Syntax error (comma) in query
expression [DateDiff("yyyy", [TWINBDAT], #1/26/2005#())]
On the report, I inserted a bound object frame and am using the
expression in the data control source.
Any help on why this won't work would be greatly appreciated. I'm not
an Access expert by any stretch, but got shouldered with this task
because I know a bit more about databases in general than anyone else I
work with... Thanks for your help.
Rob S.