How print a report in a form choosing an desired ID

  • Thread starter Thread starter Marc
  • Start date Start date
M

Marc

Dear All,

displaying a form, which has an ID data control (field), can anybody easily
tell me, how print a report referring that due ID control?
The Acces Help is not very clear about the condition Where in visual basic.

Or can anybody amending this routine:

Private Sub Comando46_Click()
On Error GoTo Err_Comando46_Click

Dim stDocName As String

stDocName = "MyReport"
DoCmd.OpenReport stDocName, acNormal, , "[ID data control]=" & Me![ID
data control]

Exit_Comando46_Click:
Exit Sub

Err_Comando46_Click:
MsgBox Err.Description
Resume Exit_Comando46_Click

End Sub

Thanks in advance for your help!
Marc
Italy
 
There should be some field on your form that uniquely identifies the
record - perhaps a primary key named "MyID".

If so, use:
DoCmd.OpenReport stDocName, acNormal, , "[MyID] = " & Me.[MyID]
 
Marc said:
Dear All,

displaying a form, which has an ID data control (field), can anybody easily
tell me, how print a report referring that due ID control?
The Acces Help is not very clear about the condition Where in visual basic.

in the message
There should be some field on your form that uniquely identifies the
record - perhaps a primary key named "MyID".

If so, use:
DoCmd.OpenReport stDocName, acNormal, , "[MyID] = " & Me.[MyID]


Thanks Allen,
tomorrow morning at work I will try the adjustments.
Kind regards,
Marc
 
Back
Top