Print Current Record

M

Mike

Hi,

I have created a command button to print the current
record however it prints all records. What changes do I
nee to make?

Dim stDocName As String

stDocName = "Current1"
DoCmd.OpenReport stDocName, acNormal

Thanks,

Mike
 
F

Fons Ponsioen

Dim stDocName As String
Dim LinkCriteria As String
LinkCriteria = "[variable name in report] = Forms!
[your form name]![variable name on form]"
stDocName = "Current1"
DoCmd.OpenReport stDocName, A_PREVIEW, , LinkCriteria
Hope this helps
Fons
 
F

fredg

Mike said:
Hi,

I have created a command button to print the current
record however it prints all records. What changes do I
nee to make?

Dim stDocName As String

stDocName = "Current1"
DoCmd.OpenReport stDocName, acNormal

Thanks,

Mike
Mike,
Look up in Access Help files:
Where clause + Restrict data to a subset of records

Assuming your Record has a unique prime key of a Number datatype:

DoCmd.OpenReport stDocName, , , "[RecordID] = " & [RecordID]

Change [RecordID] to whatever the actual name is of the prime 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