T
Tony Williams
I have a form that I use to choose the range of a report. The form has a
combo box and if this is blank I want all the records but if there is a
value I only want the report to shown the equivalent records. Here is my
code
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
stDocName = "Assigned Cases"
If Forms.[frmofficer].[cmbofficer] Is Null Then
DoCmd.OpenReport stDocName, acPreview
Else
DoCmd.OpenReport stDocName, acPreview, , "[Officer] =
Forms.[frmofficer].[cmbofficer]"
End If
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
The Where condition works but I think the first part must be wrong because I
get a message that saysObject doesn't support this property or method. Where
am I going wrong? The combobox is a text box.
TRhanks
Tony
combo box and if this is blank I want all the records but if there is a
value I only want the report to shown the equivalent records. Here is my
code
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
stDocName = "Assigned Cases"
If Forms.[frmofficer].[cmbofficer] Is Null Then
DoCmd.OpenReport stDocName, acPreview
Else
DoCmd.OpenReport stDocName, acPreview, , "[Officer] =
Forms.[frmofficer].[cmbofficer]"
End If
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
The Where condition works but I think the first part must be wrong because I
get a message that saysObject doesn't support this property or method. Where
am I going wrong? The combobox is a text box.
TRhanks
Tony