Hello all,
I'm looking for some help with what I believe will be a loop. I have the following code on a form that updates a field in a table and then prints a report for the current record. My form can be open with more than one record, however, and I would like this set of code to run for each record on the form. As always, many thanks for your tips!
[CODE=vb]Private Sub cmdPrint_Click( )
'Immediately prints one copy of the current letter.
On Error GoTo Err_cmdPrint_Cl ick
If Me.txtLetter = "Receipt Confirmation" Then
'sets checkbox to checked if letter is for Receipt Confirmation
DoCmd.OpenQuery "qryUpdateRecCo nf"
DoCmd.OpenRepor t "rptTemplateLet ters", acViewNormal
Else
DoCmd.OpenRepor t "rptTemplateLet ters", acViewNormal
End If
Exit_cmdPrint_C lick:
Exit Sub
Err_cmdPrint_Cl ick:
MsgBox Err.Description
Resume Exit_cmdPrint_C lick
End Sub[/CODE]
Software: Access 2003
Form: frmEditTemplate
Form's Record Source: qryEditTemplate
Martin
I'm looking for some help with what I believe will be a loop. I have the following code on a form that updates a field in a table and then prints a report for the current record. My form can be open with more than one record, however, and I would like this set of code to run for each record on the form. As always, many thanks for your tips!
[CODE=vb]Private Sub cmdPrint_Click( )
'Immediately prints one copy of the current letter.
On Error GoTo Err_cmdPrint_Cl ick
If Me.txtLetter = "Receipt Confirmation" Then
'sets checkbox to checked if letter is for Receipt Confirmation
DoCmd.OpenQuery "qryUpdateRecCo nf"
DoCmd.OpenRepor t "rptTemplateLet ters", acViewNormal
Else
DoCmd.OpenRepor t "rptTemplateLet ters", acViewNormal
End If
Exit_cmdPrint_C lick:
Exit Sub
Err_cmdPrint_Cl ick:
MsgBox Err.Description
Resume Exit_cmdPrint_C lick
End Sub[/CODE]
Software: Access 2003
Form: frmEditTemplate
Form's Record Source: qryEditTemplate
Martin
Comment