Solved Need help with expression in a report (1 Viewer)

Louis1017

New member
Local time
Today, 00:21
Joined
Jun 12, 2020
Messages
8
So I'm trying to add a field with an expression on a report. The current layout has a "Certificate Number" and a "Certificate Date", and I need to add an "Expiration Date" which will be one year after the "Certificate Date".

If I use =DateAdd(yyyy, 1, [CertificateDate]) I typically get a #Name? error.

There is another location in the database that shows the cert #, cert date, and expiration date on a form - so I think, "maybe I'll try to pull the data from somewhere that has the expression working correctly". So I try =[Forms]![NISTCertificate]![ExpirationDate] and get the same #Name? output. HOWEVER, if I highlight the date on the form, then run the expression on the report, it fills in the date I have selected on the form. So now I'm confused because the only way I've been able to get this to work is to open the "form", select the date I want, then open the "report" and run the expression by switching from Design View to Report View.

I should add each NISTCertificate number has a corresponding Certificate Date, so maybe I'm trying to write an expression based on the output of another expression and that is causing a problem, but I'm just not sure. I've spent the last week trying to figure this out and haven't made much progress.

I am not very fluent with Access, and someone else built this database before I came to start working on it. Any assistance is greatly appreciated.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:21
Joined
May 7, 2009
Messages
19,169
you need to enclose in quote the yyyy:

=DateAdd("yyyy", 1, [CertificateDate])
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:21
Joined
Oct 29, 2018
Messages
21,358
Hi. Welcome to AWF!

Are you able to share a sample copy of your db?
 

Louis1017

New member
Local time
Today, 00:21
Joined
Jun 12, 2020
Messages
8
you need to enclose in quote the yyyy:

=DateAdd("yyyy", 1, [CertificateDate])

Wow........ I swear I have tried that syntax in the expression and it didn't work, but I probably had written something else different with it when I used the quotations. You have no idea how happy I was to see that work when I tried it! Thank you so so so much!!!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:21
Joined
May 7, 2009
Messages
19,169
you're welcome!
 

Users who are viewing this thread

Top Bottom