Print current record in a report

G

Guest

I have designed a report to print all details of members. I want to put a
Control on the form that will print only the current record that is on the
screen. I can create the control no problem, but how do get just the current
record to print and not all records. Can I create a query for this or how?
Thanks
 
M

Marshall Barton

Roger said:
I have designed a report to print all details of members. I want to put a
Control on the form that will print only the current record that is on the
screen. I can create the control no problem, but how do get just the current
record to print and not all records. Can I create a query for this or how?


Use the OpenReport method's WhereCondition argument in the
button's procedure. The command button wizard will generate
most of the code so you only need to modify it to look like:

Dim stDocName As String
Dim stCriteria As String
stDocName = "AbsencesSkipGroup"
stCriteria = "keyfield = " & me.keyfield
DoCmd.OpenReport stDocName, acPreview, , stCriteria

where keyfield is the name of the table's primary key field.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top