needadvice
Programmer
I have a DataEntry form with a temp table. Letters print from the temp table in batch. This works fine if the letters are all the same, but if I have code on the print button to select various letters based on a DLookup field in the table, it looks for the first variable then prints all the letters in the table based on that variable. It appears to read the code only once instead of for each report. Is there another way to write this code. Should I put it somewhere other than on the print button.
I'd appreciate any suggestions.
CODE Example:
'Selects the appropriate letter for printing.
Dim VarX As String
VarX = DLookup("[LETTER]", "[COD/TEMP]"
If VarX = ("Formerly Indebted" Then
DoCmd.OpenReport "Formerly/Indebted/letter", acViewNormal
ElseIf VarX = ("Warrant" Then
DoCmd.OpenReport "Warrant Letter", acViewNormal
ElseIf VarX = ("Balance" Then
DoCmd.OpenReport "Balance Letter", acViewNormal
'Ect,Ect...
End If
This will print three "Formerly indebted" letters instead of one of each letter type.
I'd appreciate any suggestions.
CODE Example:
'Selects the appropriate letter for printing.
Dim VarX As String
VarX = DLookup("[LETTER]", "[COD/TEMP]"
If VarX = ("Formerly Indebted" Then
DoCmd.OpenReport "Formerly/Indebted/letter", acViewNormal
ElseIf VarX = ("Warrant" Then
DoCmd.OpenReport "Warrant Letter", acViewNormal
ElseIf VarX = ("Balance" Then
DoCmd.OpenReport "Balance Letter", acViewNormal
'Ect,Ect...
End If
This will print three "Formerly indebted" letters instead of one of each letter type.