T
Ted
in my code below (which is behind a 'print report' button on a form which
takes the values 'months', 'start date' and 'stop date' that act to delimit
the range of this report, when i click report, the message seems to get
printed just fine, but then it is followed by this access message:
"Microsoft Access can't find the field 'Forms' referred to in your
expression."
i think i know the part of the code it's talking about, but what would it
take to put it to sleep?
any insights'd be really welcome.
-ted
code:
Private Sub PrintReport_Click()
On Error GoTo Err_PrintReport_Click
Dim response1 As Integer
Dim stDocName As String
Dim strWhere As String
Dim response2 As Integer
If IsNull(Me.Months) = True Or IsNull(Me.StartDate) = True Or
Me.StopDate = #1/1/1899# Then
response2 = MsgBox("You have entered at least one invalid date. Review
and correct your entries.", vbOKOnly + vbCritical, "Error")
GoTo Line1
Else: response1 = MsgBox( _
"Your specifications call for printing a report for patients at their "
& Forms![Tracking Print Filtered By Months]![Months] & _
" months visit which spans the dates " & Forms![Tracking Print Filtered
By Months]![StartDate] & " and " _
& Forms![Tracking Print Filtered By Months]![StopDate] _
& ". If this is correct, click 'OK' to proceed or else click 'Cancel'
and re-enter them.", vbOKCancel + vbInformation, "Attention User")
If response1 = 1 Then
stDocName = "Selected Months Patients on Follow-Up"
strWhere = Forms![Tracking Print Filtered By Months]![Months] & _
[FollowUp] & "Between #" & Forms![Tracking Print Filtered By
Months]![StartDate] & _
"# And #" & Forms![Tracking Print Filtered By Months]![StopDate] & "#"
DoCmd.OpenReport stDocName, acViewNormal, , strWhere
ElseIf response1 = 2 Then GoTo Line1
End If
Exit_PrintReport_Click:
Exit Sub
Err_PrintReport_Click:
MsgBox Err.description
Resume Exit_PrintReport_Click
End If
Line1:
End Sub
takes the values 'months', 'start date' and 'stop date' that act to delimit
the range of this report, when i click report, the message seems to get
printed just fine, but then it is followed by this access message:
"Microsoft Access can't find the field 'Forms' referred to in your
expression."
i think i know the part of the code it's talking about, but what would it
take to put it to sleep?
any insights'd be really welcome.
-ted
code:
Private Sub PrintReport_Click()
On Error GoTo Err_PrintReport_Click
Dim response1 As Integer
Dim stDocName As String
Dim strWhere As String
Dim response2 As Integer
If IsNull(Me.Months) = True Or IsNull(Me.StartDate) = True Or
Me.StopDate = #1/1/1899# Then
response2 = MsgBox("You have entered at least one invalid date. Review
and correct your entries.", vbOKOnly + vbCritical, "Error")
GoTo Line1
Else: response1 = MsgBox( _
"Your specifications call for printing a report for patients at their "
& Forms![Tracking Print Filtered By Months]![Months] & _
" months visit which spans the dates " & Forms![Tracking Print Filtered
By Months]![StartDate] & " and " _
& Forms![Tracking Print Filtered By Months]![StopDate] _
& ". If this is correct, click 'OK' to proceed or else click 'Cancel'
and re-enter them.", vbOKCancel + vbInformation, "Attention User")
If response1 = 1 Then
stDocName = "Selected Months Patients on Follow-Up"
strWhere = Forms![Tracking Print Filtered By Months]![Months] & _
[FollowUp] & "Between #" & Forms![Tracking Print Filtered By
Months]![StartDate] & _
"# And #" & Forms![Tracking Print Filtered By Months]![StopDate] & "#"
DoCmd.OpenReport stDocName, acViewNormal, , strWhere
ElseIf response1 = 2 Then GoTo Line1
End If
Exit_PrintReport_Click:
Exit Sub
Err_PrintReport_Click:
MsgBox Err.description
Resume Exit_PrintReport_Click
End If
Line1:
End Sub