By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

Print Report Based on Form

P: n/a
Hello,

I have a form and subform with their tables linked by a field called
Load_ID. I have a button on my subform that prints just the items listed on
that particular subform (looking at Load_ID). I'm using the following code:

DoCmd.OpenReport "Load Sheet", acPreview, , "[Load_ID]= " & "'" &
Me.Parent.Form![Load_ID] & "'"

This works fine, but now I want to automate the process, so I set the
Load_ID on the main form/table to be an AutoNumber field. I changed
subform/other table Load_ID to a number field (it was a text field), but I
get the following error when I press the print report button:

Run-time error '3464'

Data type mismatch in criteria expression.

I assume this is because my Load_ID is a number value instead of text. My
question is, how do I re-write the above command to get it to work with
number values? Any help would be appreciated.

Thanks,

Chad
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Chad,
You don't need the quote marks around a number. Access thinks you are
trying to pass a string, even if it's all numbers.

DoCmd.OpenReport "Load Sheet", acPreview, , "[Load_ID]= " &
Me.Parent.Form![Load_ID]

should do the trick.

Nov 13 '05 #2

P: n/a
That worked great. Thanks for the quick reponse. That solved my problem.

Thanks,

Chad
"Wolf" <sp*************@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Chad,
You don't need the quote marks around a number. Access thinks you are
trying to pass a string, even if it's all numbers.

DoCmd.OpenReport "Load Sheet", acPreview, , "[Load_ID]= " &
Me.Parent.Form![Load_ID]

should do the trick.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.