Printing Records

Freelak

New member
Local time
Today, 04:21
Joined
Aug 19, 2000
Messages
9
I know this question has probably been asked before, but I just can't figure out how to do this.

I want to create a button that will print a report for only the currently displayed record.

The wizard creates a button that will print all records. I have triied for hours modifing the code to make it print only the displayed record, with no success.
frown.gif


Would someone please help!?

Thank You in advance!

Freelak
 
Use code like this:

DoCmd.OpenReport "ReportName", acViewNormal, , "[UniqueRecordIdentifer] = " & Me![FieldOnFormWithUniqueIdentifer]

Replace the UniqueRecord bit with your records ID number, or whatever you use.

HTH,
Jack

[This message has been edited by Jack Cowley (edited 08-19-2000).]
 
Jack, Thank you very much for your response!
I am still having problems…
I have used the following line:

DoCmd.OpenReport stDocName, acViewPreview, , "[FOOD] =" & Me![Recipe Name]

I get the following error returned:

Syntax error (missing operator) in query expression '([FOOD] = Greek Chicken)'.

FOOD is the Name of the field in the table.
Greek Chicken IS the Recipe Name of the current record!

What is it I'm doing wrong?

Thank You again.

SPACE
 
Since your unique ID is text and not a number then the code should look like this:

DoCmd.OpenReport stDocName, acViewPreview, , "[FOOD] = ' " & Me![Recipe Name] & " ' "

(I have added extra space between the single quotes and double quotes to make it easier to read. Leave those spaces out in your code.)

Give that a try and lets hope that cures your problem....

Jack

[This message has been edited by Jack Cowley (edited 08-20-2000).]
 
Yes..Yes..Yes!

Thank you very much!

And again!

Freelak
 

Users who are viewing this thread

Back
Top Bottom