G
Guest
I have a form and a report that are pretty much identical. I want to create a cmd button to print the current record that is visible on the form. I am missing a piece and can't figure it out.
I want to create a cmd button to print the current record-----Original Message-----
I have a form and a report that are pretty much identical.
get all [CustID]'s not just the current record. I would like to get the[email protected] said:Jim
Thank a ton, but I have one snag. The code you gave me worked great but I
Brad
Jim/Chris said:I got this from a prevfious post. It works fine.
You will need to add a Where Condition to the OpenReport
method so that the report shows only the information for
the record displayed on your form. For example, if the
field on your form that uniquely identifies the record is
CustID, you could use it to determine the where condition
as follows:
Dim strCriteria As String
' This works when your CustID field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria
' This works when your CustID field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria
Jim
I want to create a cmd button to print the current record-----Original Message-----
I have a form and a report that are pretty much identical.
that is visible on the form. I am missing a piece and
can't figure it out.