Eric the Viking
Registered User.
- Local time
- Today, 00:02
- Joined
- Sep 20, 2012
- Messages
- 70
Dear All
I have a continuous form and have set up a right click popup menu on the record number control to allow me to print from a list of reports which works fine - it was set up using the Tools/Customize method.
The reports are based on queries which ask for the parameter record_number. I would like to automate this so the record number I am clicking on in the continuous form is passed to the relevant query. I have done this elsewhere ie on another continuous form using the following code when not using a popup menu because there is only one report option:
Private Sub Command21_Click()
On Error GoTo Err_Command21_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rpt-individualReport"
stLinkCriteria = "[Event no]=" & Me![Event no]
DoCmd.OpenReport stDocName, , , stLinkCriteria
' Dim stDocName As String
'DoCmd.OpenReport stDocName, acNormal
Exit_Command21_Click:
Exit Sub
Err_Command21_Click:
MsgBox Err.Description
Resume Exit_Command21_Click
End Sub
What I don't know is how I can put this into the right click popup menu method I have on the continuous form.
Suggestions would be gratefully received - I am presuming I will have to set up the right click menu using VBA but have not been able to find a solution so far and I am still very much on the learning curve with VBA.....
Cheers
Eric
I have a continuous form and have set up a right click popup menu on the record number control to allow me to print from a list of reports which works fine - it was set up using the Tools/Customize method.
The reports are based on queries which ask for the parameter record_number. I would like to automate this so the record number I am clicking on in the continuous form is passed to the relevant query. I have done this elsewhere ie on another continuous form using the following code when not using a popup menu because there is only one report option:
Private Sub Command21_Click()
On Error GoTo Err_Command21_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rpt-individualReport"
stLinkCriteria = "[Event no]=" & Me![Event no]
DoCmd.OpenReport stDocName, , , stLinkCriteria
' Dim stDocName As String
'DoCmd.OpenReport stDocName, acNormal
Exit_Command21_Click:
Exit Sub
Err_Command21_Click:
MsgBox Err.Description
Resume Exit_Command21_Click
End Sub
What I don't know is how I can put this into the right click popup menu method I have on the continuous form.
Suggestions would be gratefully received - I am presuming I will have to set up the right click menu using VBA but have not been able to find a solution so far and I am still very much on the learning curve with VBA.....
Cheers
Eric