T
Tony Williams
I have a form with a command button that opens a report in preview. The form
has a combo box from which you select the record that should be shown on the
report but when I click on the command button I get all the records not just
the one I have clicked What's wrong with my code?
Here it is
Private Sub cmdprintcr_Click()
On Error GoTo Err_cmdprintcr_Click
Dim strAVCISCode As String
'set strAVCISCode equal to the selected value before closing the form,
otherwise it will give us an error
strAVCISCode = "AVCISCode"
DoCmd.OpenReport "rptCrimereport", acViewPreview,
"strAVCIScode=[AVCISCodea]"
Exit_cmdprintcr_Click:
Exit Sub
Err_cmdprintcr_Click:
MsgBox Err.Description
Resume Exit_cmdprintcr_Click
End Sub
AVCISCode is the field holding the number of the record I want and
AVCISCodea is the name of the control combobox on my form.
Thanks in anticipation
Tony
has a combo box from which you select the record that should be shown on the
report but when I click on the command button I get all the records not just
the one I have clicked What's wrong with my code?
Here it is
Private Sub cmdprintcr_Click()
On Error GoTo Err_cmdprintcr_Click
Dim strAVCISCode As String
'set strAVCISCode equal to the selected value before closing the form,
otherwise it will give us an error
strAVCISCode = "AVCISCode"
DoCmd.OpenReport "rptCrimereport", acViewPreview,
"strAVCIScode=[AVCISCodea]"
Exit_cmdprintcr_Click:
Exit Sub
Err_cmdprintcr_Click:
MsgBox Err.Description
Resume Exit_cmdprintcr_Click
End Sub
AVCISCode is the field holding the number of the record I want and
AVCISCodea is the name of the control combobox on my form.
Thanks in anticipation
Tony