Date criteria with any day

G

Garret

Hello,

I'm looking to open a report using a line of code like this:

DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
"tblGages.LastCalib = #" & Month & "/1/" & Year &
"#"

where Month and Year hold numeric values entered by the user. I have
the "1" there right now as a temporary character. I'm looking to make
it so the criteria uses that Month and Year value, but works for any
day. I thought of some solutions but ran into the problem that some
months have 29, some 30, some 31, days.

Thanks for any help.
 
G

Guest

DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
"(Month(tblGages.LastCalib) = " & Month & "and
year(tblGages.LastCalib) = & Year &")"
 
G

Garret

Thanks, it was just what I wanted. I ended up using this statement:

DoCmd.OpenReport "rptMontlyCalibration", acViewPreview, , _
"(Month(tblGages.LastCalib) = " & Month & _
"and Year(tblGages.LastCalib) = " & Year & ")"

It turns out that you left out some quotation marks. Thanks bunches
though!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top