conditional report selection A2002, Windows2000

  • Thread starter Thread starter Brigitte P
  • Start date Start date
B

Brigitte P

In an effort to manage a mailing list, I have selected
those marked for deletion with "Yes" and those marked for
possible keeping with "No" in the field DelCheck. Now I
want to create a button that selects the letter based on
the value of that field. The record source is an
underlying query. I tried the following code that's not
working:
Private Sub cmdMailingListMgmt_Click()
On Error GoTo Err_cmdMailingListMgmt_Click
Dim stDocName As String
stDocName = "qryMAILINGDeleteKeep"
DoCmd.OpenQuery stDocName, acNormal, acEdit

If (Query!qryMAILINGDeleteKeep!DelCheck) = "Yes" Then
stDocName = "MailingLabelsDELETELetter"
DoCmd.OpenReport stDocName, acPreview
Else
stDocName = "MailingLabelsKEEPLetter"
DoCmd.OpenReport stDocName, acPreview
End If


Exit_cmdMailingListMgmt_Click:
Exit Sub

Err_cmdMailingListMgmt_Click:
MsgBox Err.Description
Resume Exit_cmdMailingListMgmt_Click

End Sub

My idea was to run the query first, and then based on the
value of the field in the query, the appropriate letter
should be selected. Obviously, I don't know what I'm doing.

I want the letters (regardless whether Keep or Delete
letter) to stay in the same order as the labels (ZIP,
CITY, AGENCY), and both reports are set up this way.
Labels print fine.
Would someone please help me.
Brigitte P.
 
Thanks, I resolved it by putting the text in different
textboxes and then select via OnPrint Event the
appropriate textboxes, depending whether condition was met
or not. Maybe not the best solution, but it worked.
Brigitte P.
 
Back
Top