I have a combo box on a form to filter a report that is (for this project) by attorney. You can choose which attorney to show the report for. This is the code that I have:
The gstrReportName is passed as an openargs from a previous reports form.
CLeadAttorney is a field in tblCases and is linked to tblAttorney lookup, storing the attorney's ID.
cboAttorney, or stlinkcriteria, has the following rowsource as it is unbound:
Can anyone help? Did I miss any needed information? Please let me know if I did.
Thank you,
misscrf
It is never too late to become what you could have been ~ George Eliot
Code:
Private Sub cmdrptAttorney_Click()
On Error GoTo Err_cmdrptAttorney_Click
Dim stLinkCriteria As String
stLinkCriteria = Me.cboAttorney
DoCmd.OpenReport gstrReportName, acPreview, , "CLeadAttorney =" & stLinkCriteria, acWindowNormal
Exit_cmdrptAttorney_Click:
Exit Sub
Err_cmdrptAttorney_Click:
If Err <> 2501 Then
msgbox Err.Description
End If
Resume Exit_cmdrptAttorney_Click
End Sub
The gstrReportName is passed as an openargs from a previous reports form.
CLeadAttorney is a field in tblCases and is linked to tblAttorney lookup, storing the attorney's ID.
cboAttorney, or stlinkcriteria, has the following rowsource as it is unbound:
Code:
SELECT tblCases.CLeadAttorney, tblAttorney.AttFirstName, tblAttorney.AttLastName FROM tblCases LEFT JOIN tblAttorney ON tblCases.CLeadAttorney=tblAttorney.AttTimeKeeper GROUP BY tblCases.CLeadAttorney, tblAttorney.AttFirstName, tblAttorney.AttLastName ORDER BY tblAttorney.AttLastName;
Can anyone help? Did I miss any needed information? Please let me know if I did.
Thank you,
misscrf
It is never too late to become what you could have been ~ George Eliot