Where's the error in the code?
Posted on 2003-03-20
I use a form to select multiple addresses for the print of envelopes. For the indication of a customers address, I use KIDNR, which contains numbers and letters. I use now
Private Sub Umschaltfläche6_Click()
Dim Element As Variant
Dim Bedingung As String
Dim KIDNR As Variant
If Liste.ItemsSelected.Count = 0 Then Exit Sub
For Each Element In Liste.ItemsSelected
KIDNR = Liste.ItemData(Element)
Bedingung = Bedingung & _
"KIDNR= " & KIDNR & " OR "
Bedingung = Left(Bedingung, Len(Bedingung) - 4)
DoCmd.OpenReport "Couvert spezVersand", acPreview, , Bedingung
DoCmd.Close acForm, "Couvert spezial Mehrfachauswahl", acSaveNo
But this does not properly work. After choosing the addresses, I get a small pop-up where I have to put in KIDNR manually, after have this done, the report opens and all the chosen addresses appearing.