G
Guest
I have a report for printing labels, I have a dialog box to choose a name,
however I can only choose one name for the report. Can I make this so I can
choose the names I want to print labels for with all the names being on one
report? Don't know if you need this, here is the event procedure for the
dialog box. I stole it from the sample database.
Private Sub cmdApplyFilter_Click()
Dim strNAME As String
Dim strFilter As String
' Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "MAILING LABEL") <>
acObjStateOpen Then
MsgBox "You must open the report first."
Exit Sub
End If
' Build criteria string for Office field
If IsNull(Me.cboNAME.Value) Then
strNAME = "Like '*'"
Else
strNAME = "='" & Me.cboNAME.Value & "'"
End If
' Combine criteria strings into a WHERE clause for the filter
strFilter = "[NAME] " & strNAME
' Apply the filter and switch it on
With Reports![MAILING LABEL]
.Filter = strFilter
.FilterOn = True
End With
End Sub
Private Sub cmdRemoveFilter_Click()
On Error Resume Next
' Switch the filter off
Reports![MAILING LABEL].FilterOn = False
End Sub
however I can only choose one name for the report. Can I make this so I can
choose the names I want to print labels for with all the names being on one
report? Don't know if you need this, here is the event procedure for the
dialog box. I stole it from the sample database.
Private Sub cmdApplyFilter_Click()
Dim strNAME As String
Dim strFilter As String
' Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "MAILING LABEL") <>
acObjStateOpen Then
MsgBox "You must open the report first."
Exit Sub
End If
' Build criteria string for Office field
If IsNull(Me.cboNAME.Value) Then
strNAME = "Like '*'"
Else
strNAME = "='" & Me.cboNAME.Value & "'"
End If
' Combine criteria strings into a WHERE clause for the filter
strFilter = "[NAME] " & strNAME
' Apply the filter and switch it on
With Reports![MAILING LABEL]
.Filter = strFilter
.FilterOn = True
End With
End Sub
Private Sub cmdRemoveFilter_Click()
On Error Resume Next
' Switch the filter off
Reports![MAILING LABEL].FilterOn = False
End Sub