ClaraBarton
Registered User.
- Local time
- Yesterday, 23:22
- Joined
- Oct 14, 2019
- Messages
- 578
I have 8 fields that are not part of the recordset that I need to pass values from the form to the report. The following code debugs right but the values do not get passed to the report.
I originally tried OpenArgs but it got too cumbersome. Is there some way to make this work?
Code:
Private Sub cmdPrint_Click()
On Error GoTo ErrorCode
Dim frm As Form
Me.Visible = False
If Me!togMonth = True Then
DoCmd.OpenReport "rptMonth", acViewPreview
Else
DoCmd.OpenReport "rptWeek", _
View:=acViewPreview
Set frm = Me!frmCalendarWeek.Form
With Reports("rptWeek")
.txtDate = Me.[txtDate]
.NoteSun = frm.[NoteSun]
.NoteMon = frm.[NoteMon]
.NoteTues = frm.[NoteTues]
.NoteWed = frm.[NoteWed]
.NoteThurs = frm.[NoteThurs]
.NoteFri = frm.[NoteFri]
.NoteSat = frm.[NoteSat]
End With
DoCmd.Close acForm, Me.name
End If
Exit Sub
ErrorCode:
If Err = 2501 Then Exit Sub
MsgBox Err.description
End Sub