Customers table has agent's Primary key as a field., like wise gaurentor's too
now i want to print the filtered report based on the two combo-box's selection .
i have tried this code
Expand|Select|Wrap|Line Numbers
- Option Compare Database
- Private Sub Command2_Click()
- Dim strBranch As String
- Dim strCity As String
- Dim strFilter As String
- ' Check that the report is open
- If SysCmd(acSysCmdGetObjectState, acReport, "Report1") <> acObjStateOpen Then
- MsgBox "You must open the report first."
- Exit Sub
- End If
- ' Build criteria string for Office field
- If IsNull(Me.Combo0.Value) Then
- strBranch = "Like '*'"
- Else
- strBranch = "='" & Me.Combo0.Value & "'"
- End If
- ' Build criteria string for DT field
- If IsNull(Me.Combo2.Value) Then
- strCity = "Like '*'"
- Else
- strCity = "='" & Me.Combo2.Value & "'"
- End If
- ' Combine criteria strings into a WHERE clause for the filter
- strFilter = "[Branch] " & strBranch & " AND [DT] " & strCity
- ' Apply the filter and switch it on
- With Reports![Report1]
- .Filter = strFilter
- .FilterOn = True
- End With
- End Sub