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

Printing a single record in Access

P: 4
I have set up an event to print a single record report in access with the criteria below, however each time I enter a claim ID to preview a report, I am able to see the correct claim ID but the information along with the ID is incorrect. Can someone tell me what I am doing wrong. The claim id is numeric.

Private Sub cmdPrintRecord_Click()

Dim strReportName As String
Dim strWhere As String

strReportName = "rptNurseMonitor"
strCriteria = "[ClaimID]=""" & Me![ClaimID] & """"
DoCmd.OpenReport strReportName, acViewPreview, , strWhere

End Sub

Janet
Aug 9 '07 #1
Share this Question
Share on Google+
6 Replies


FishVal
Expert 2.5K+
P: 2,653
I have set up an event to print a single record report in access with the criteria below, however each time I enter a claim ID to preview a report, I am able to see the correct claim ID but the information along with the ID is incorrect. Can someone tell me what I am doing wrong. The claim id is numeric.

Private Sub cmdPrintRecord_Click()

Dim strReportName As String
Dim strWhere As String

strReportName = "rptNurseMonitor"
strCriteria = "[ClaimID]=""" & Me![ClaimID] & """"
DoCmd.OpenReport strReportName, acViewPreview, , strWhere

End Sub

Janet
Hi, Janet.
Replace
Expand|Select|Wrap|Line Numbers
  1. strCriteria = "[ClaimID]=""" & Me![ClaimID] & """"
with
Expand|Select|Wrap|Line Numbers
  1. strWhere = "[ClaimID]=" & Me![ClaimID]
Good luck.
Aug 9 '07 #2

P: 4
Hi, Janet.
Replace
Expand|Select|Wrap|Line Numbers
  1. strCriteria = "[ClaimID]=""" & Me![ClaimID] & """"
with
Expand|Select|Wrap|Line Numbers
  1. strWhere = "[ClaimID]=" & Me![ClaimID]
Good luck.
I reset this and now am receiving another error message, see below
(This expression is typed incorrectly, or it it too complex to be evaluated. For, example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.)

Can you help with this?

Janet
Aug 9 '07 #3

FishVal
Expert 2.5K+
P: 2,653
I reset this and now am receiving another error message, see below
(This expression is typed incorrectly, or it it too complex to be evaluated. For, example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.)

Can you help with this?

Janet
Are you sure [ClaimID] is numeric type? Plz chk it table design view.
Aug 9 '07 #4

P: 4
Are you sure [ClaimID] is numeric type? Plz chk it table design view.
I did check and you are right the ClaimID is text. I changed this the expression back to what it was and still have the problem of the ClaimID is correct, but the information is not correct. If I first do a find record and then use the command button I get the right information. Is there a way to build an expression that will first find the correct record and then print preview for printing a single report? I would like to build this in one command button.

Thanks
Janet
Aug 9 '07 #5

FishVal
Expert 2.5K+
P: 2,653
I did check and you are right the ClaimID is text. I changed this the expression back to what it was and still have the problem of the ClaimID is correct, but the information is not correct. If I first do a find record and then use the command button I get the right information. Is there a way to build an expression that will first find the correct record and then print preview for printing a single report? I would like to build this in one command button.

Thanks
Janet
Sorry. This part needs to be translated. ;)

What do you mean saying
If I first do a find record and then use the command button I get the right information.
.The code will work if the form is pointed to a right record. Do you want another interface?
Aug 9 '07 #6

P: 4
Sorry. This part needs to be translated. ;)

What do you mean saying .The code will work if the form is pointed to a right record. Do you want another interface?
I think that I have the problem solved now. Thanks so much for the help
Aug 10 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.