conditional report selection A2002, Windows2000


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
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
stDocName = "MailingLabelsKEEPLetter"
DoCmd.OpenReport stDocName, acPreview
End If

Exit Sub

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.

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.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question