View Full Version : Printing A Record from a Sub Form


johnhobbis
04-15-2001, 08:30 AM
I have tried this but come up with an error 2501 every time..........

Any Ideas

Private Sub Print_Record_Click()
Dim strDocName As String
Dim strWhere As String
strDocName = "Rpt_followup_visit_small"
strWhere = "[OutreachID]=" & Me!OutReachID
DoCmd.OpenReport strDocName, acViewNormal, , strWhere

Fornatian
04-16-2001, 10:51 AM
John.

Assuming that OutreachID is a number you have the correct syntax for the where statement.(If it's text you need to put single quotes around the criteria).

Normally I leave a space after the '=' but I don't know if that has any significance.

Another thing to check is that the controls which hold the OutreachID are called OutreachID - If you pull them onto the report or form more than once they will have different names like Command27 etc...

Just a few things to ponder..

Ian