Printing record displayed on form

IanC

New member
Local time
Today, 07:16
Joined
Nov 20, 2000
Messages
9
On a form, I've added a button to print just the currently displayed record.

The OnClick event of that button goes to a procedure that calls a report with the "DoCmd.OpenReport". The "WHERE" clause set to only print the current record number.

Unfortunately the report insists on printing all records in the table.

Looked for help on the Microflacid site. It said to set it up as a macro. The macro does print only the single record I want using the exact same "WHERE" clause.

Why doesn't it work in the procedure, but does as a macro? Any suggestions on how to get it to work using the procedure?

I'm using Access 97 in case that has any bearing on your answer.
 
Open the form in design view, go to Tool and Macros. Click on Convert form's macros to Visual Basic.
That will "write" the procedure for you and you can compare that code with your code.
 
Thanks Neil.

Turns out that I forgot to enclose the "WHERE" clause in quotation marks. Once that was done, it works like a charm.
 

Users who are viewing this thread

Back
Top Bottom