View Full Version : Printing record displayed on form


IanC
11-20-2000, 06:32 AM
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.

Neal
11-20-2000, 08:11 AM
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.

IanC
11-20-2000, 09:01 AM
Thanks Neil.

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