K
Kathy R.
I am working on a form that uses an option gorup and combo
box to select records for printing labels. i found some
sample code that i used to make this work, however i don't
really understand why you need the two criteria "crit"
and "orig" in the openreport method.. it seems redundant,
like just one of them would be adequate. SelectOrigin is
the combo box with list of groups and OriginID is the
primary key in the origins table. Can someone please
explain? please see code below. thanks so much in
advance...
Dim orig As Long, Crit, ErrMsg As String
'Contact_Mailing_Labels
'
If Me.PrintLabelsFor = 2 Then
If Not IsNull(Me.SelectOrigin) Then
orig = Me.SelectOrigin
Crit = "[OriginID] = " & orig 'build criteria to
apply
DoCmd.OpenReport "Contact_Mailing_Labels",
acViewPreview, , Crit
Else ' user didn't select an origin, ask them
to do so
ErrMsg = "Please select an origin"
MsgBox ErrMsg
End If
Else
DoCmd.OpenReport "Contact_Mailing_Labels",
acViewPreview
End If
box to select records for printing labels. i found some
sample code that i used to make this work, however i don't
really understand why you need the two criteria "crit"
and "orig" in the openreport method.. it seems redundant,
like just one of them would be adequate. SelectOrigin is
the combo box with list of groups and OriginID is the
primary key in the origins table. Can someone please
explain? please see code below. thanks so much in
advance...
Dim orig As Long, Crit, ErrMsg As String
'Contact_Mailing_Labels
'
If Me.PrintLabelsFor = 2 Then
If Not IsNull(Me.SelectOrigin) Then
orig = Me.SelectOrigin
Crit = "[OriginID] = " & orig 'build criteria to
apply
DoCmd.OpenReport "Contact_Mailing_Labels",
acViewPreview, , Crit
Else ' user didn't select an origin, ask them
to do so
ErrMsg = "Please select an origin"
MsgBox ErrMsg
End If
Else
DoCmd.OpenReport "Contact_Mailing_Labels",
acViewPreview
End If