Print Current Record From A Form

Print Current Record From A Form

Post by S2VubnkgR » Sat, 08 Nov 2008 23:23:01


Hello,

Using Access 2002

I am trying to print the current record from a form. I do get the report
using the below listed code. However, I don't just get the current
information on the subform, I get all the information on the subform and I
just want the data from the displayed record. Any help will be appreciated.

Private Sub cmdPrintCurrentRecord_Click()
Dim strWhere As String

strWhere = "[AutoID] = " & Me.[AutoId]
DoCmd.OpenReport "Client History Individual Report", acViewPreview, ,
strWhere
End Sub



--
Kenny G
 
 
 

Print Current Record From A Form

Post by Klatu » Sat, 08 Nov 2008 23:55:38

The code looks correct, but based on your description, my guess is that
AutoID is actually a foreign key to the parent record on the main form. If
you want just a specific record on the sub form, you need to have that
record as the current record in the subform and use a field that is unique
to the child record. In fact, you probably need both fields to compare on.

 
 
 

Print Current Record From A Form

Post by S2VubnkgR » Tue, 11 Nov 2008 09:45:01

Klatuu,

Thanks!
--
Kenny G