View Full Version : Printing Records


Freelak
08-19-2000, 03:04 PM
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. http://www.access-programmers.co.uk/ubb/frown.gif

Would someone please help!?

Thank You in advance!

Freelak

Jack Cowley
08-19-2000, 03:11 PM
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).]

Freelak
08-19-2000, 07:18 PM
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

Jack Cowley
08-20-2000, 06:36 PM
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).]

Freelak
08-21-2000, 05:42 AM
Yes..Yes..Yes!

Thank you very much!

And again!

Freelak