Print Current Record

  • Thread starter Thread starter Mike
  • Start date Start date
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
 
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
 
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.
 
Back
Top