G
Guest
Hi
Can anyone help. I'm not too good at VBA and I am trying to write a
timesheet database. I want to open a specific report based on the client
name and the month. These are selected from unbound combo boxes on an
unbound form. I want the user to click on a button to generate the relevant
report. However, it's not working!!! The code is on the On Click event of
the button. Can someone have a look at this code and tell me what I am doing
wrong. I would be very grateful!!!
Private Sub btnOpenClientMonth_Click()
On Error GoTo HandleError
DoCmd.OpenReport "rpt_timesheet_by_client_and_month", acViewPreview, , _
"Client = Forms!frm_select_report!cmbClientName" _
And "Month = Forms!frm_select_report!cmbMonthName"
Exit Sub
HandleError:
MsgBox "You must select a client and a month"
End Sub
Thanks for taking a look
Aehan
Can anyone help. I'm not too good at VBA and I am trying to write a
timesheet database. I want to open a specific report based on the client
name and the month. These are selected from unbound combo boxes on an
unbound form. I want the user to click on a button to generate the relevant
report. However, it's not working!!! The code is on the On Click event of
the button. Can someone have a look at this code and tell me what I am doing
wrong. I would be very grateful!!!
Private Sub btnOpenClientMonth_Click()
On Error GoTo HandleError
DoCmd.OpenReport "rpt_timesheet_by_client_and_month", acViewPreview, , _
"Client = Forms!frm_select_report!cmbClientName" _
And "Month = Forms!frm_select_report!cmbMonthName"
Exit Sub
HandleError:
MsgBox "You must select a client and a month"
End Sub
Thanks for taking a look
Aehan