Access

  • Thread starter Thread starter Michelle
  • Start date Start date
M

Michelle

I have a problem, i'm trying to print only the current
record. I have a form which i have a command Print button
which prints a report, but i only want the current record,
which i will not know the context of as this form will be
used by many and they will need to print their record only.

Thanks.
 
Hi Michelle,

You will need to go into the SQL statement (query) and
point the Record ID to the record ID on the form.

Example:

Field Record ID:

[Forms]![MyForm]![FormRecordID]

This should work.

Tony
 
Hi Michelle!!
If you want to print the content of the form in front of u
then just make sure that the code in your print button
looks like this:

DoCmd.PrintOut acSelection, , , , , False

To get there, right-click on print button, then select the
BBUILD EVENT wizard. This should bring you to VBA code.
Just check the line above and make sure they matches
exactly. If in the other hand, you might have to
select 'Code builder' and past the above line of code.

this will allow you to print the current record, if you
move to another record ans select print, only this record
will be printed, so on and so.

hope this helps!
 
I presume that you used the OpenReport Method in the code for the
CommandButton. In this case, use the "WhereCondition" argument of the
OpenReport Method to restrict the Report to only the current Record.

Check Access VB Help on the OpenReport Method to see how the
"WhereCondition" argument (and other arguments) are used.
 
Back
Top