G
Guest
I am having a problem with the coding below is in the Event Procedure on the
“On Open†property of the {rptLetter}:
Sub cmdPrint_Click()
'Check if no results in any field, if all missing
'inform user and exit report
'Check that [frmExam Data] is the name of the
'subform control, not just the name of the form
'contained.
If Me.[frmExam Data].Form.Me.Trichomonal <> True _
And Me.[frmExam Data].Form.Me.Bacterial <> True _
And Me.[frmExam Data].Form.Me.Yeast <> True Then
MsgBox "This individual does not have any Exam Data entered." & _
Chr(13) & "Previewing / Printing is canceled. " & _
Chr(13) & Chr(13) & "Check if Exam Data is Available and Re-run", vbOKOnly +
vbInformation
Else
DoCmd.OpenReport rptLetter, acViewPreview
End If
I am having a problem with the coding at the bottom of this post that
someone was trying to help me with in another website, we thought it was
going to work. I inherited this database and issue. My result I want is:
when I press the Cmd Button on the {frmPatient Data}, if there is a matching
subrecord, I want to view the {rptLetter} ready for printing, and update the
[ResultsNotified] field automatically in the subdatasheet table {ExamData} as
it gets printed. If any of the 3 fields [Trichomonal], [Bacterial], and
[Yeast], Yes/No fields located in the subdatasheet table, are actively
checked, display only the contents of those that are checked. If there is no
matching subrecord, I want the msg: "This individual does not have any Exam
Data entered. Check if Exam Data is Available and Re-Run.†I want the
printing to be cancelled and return back to the {frmPatient Data}, without
any further updates.
Currently: 1) After pressing the Cmd Button, for those with a subrecord,
the data is displayed to include all 3 fields, regardless if they are
actively checked or not. The active fields should be displayed only if they
are actively checked. Upon closing, the [ResultsNotified] is automatically
updated which should be the case. 2) For those individuals without a
subrecord, the {rptLetter} is displayed for printing, which shouldn’t be.
The Msg Box does not appear at all. When closing, the [ResultsNotified]
field still gets automatically updated, creating a new record in the
subdatasheet table {Exam Data}which shouldn’t be the case.
Information: The {frmPatient Data} has a subform {frmExam Data}, table
source is {PatientData} and {ExamData} respectfully. The [SSN] is the link
between the 2 tables. The [SSN] is the Primary Key in the 1st table and
[ExamID] in the 2nd table. The 3 fields [Trichomonal], [Bacterial], and
[Yeast] are fields in the subdatasheet {ExamData} which are Yes/No fields.
The macro [UpdatePrintNotice] is attached to the Cmd Button “Print
Notificationâ€, “On Click†property, which has 2 actions:
SetValue: Item: [Forms]![frmPatient Data]![frmExam
Data]![ResultsNotified]; Expression: Date()
OpenReport: Report Name: rptLetter; View: Print Preview; Filter Name:
blank; Where Condition: [ExamData]![ExamID]=[Forms]![frmPatient
Data]![frmExam Data]![ExamID].
I noticed that there is a filter turned not on in the Property of the
{rptLetter}. The filter is: ([ExamData]![ExamID]=[Forms]![frmPatient
Data]![frmExam Data]![ExamID]) which is the same as stated in the Where
Condition of the macro above; and the next property Filter On: is “Noâ€. Does
this make sense!
I have a 2nd macro {ClearNotified} which I can not find where it is being
used in the database; it has 1 action:
SetValue: Item: [Forms]![frmExam Data]![ResultsNotified]; Expression: Null
Further, there is also a filter on the subform {frmExam Data} as: ((Not
Lookup_ResultsID.ExamResults1="WNL")); and Order by:
Lookup_Provider.Provider. I don’t know if this is affecting the error.
“On Open†property of the {rptLetter}:
Sub cmdPrint_Click()
'Check if no results in any field, if all missing
'inform user and exit report
'Check that [frmExam Data] is the name of the
'subform control, not just the name of the form
'contained.
If Me.[frmExam Data].Form.Me.Trichomonal <> True _
And Me.[frmExam Data].Form.Me.Bacterial <> True _
And Me.[frmExam Data].Form.Me.Yeast <> True Then
MsgBox "This individual does not have any Exam Data entered." & _
Chr(13) & "Previewing / Printing is canceled. " & _
Chr(13) & Chr(13) & "Check if Exam Data is Available and Re-run", vbOKOnly +
vbInformation
Else
DoCmd.OpenReport rptLetter, acViewPreview
End If
I am having a problem with the coding at the bottom of this post that
someone was trying to help me with in another website, we thought it was
going to work. I inherited this database and issue. My result I want is:
when I press the Cmd Button on the {frmPatient Data}, if there is a matching
subrecord, I want to view the {rptLetter} ready for printing, and update the
[ResultsNotified] field automatically in the subdatasheet table {ExamData} as
it gets printed. If any of the 3 fields [Trichomonal], [Bacterial], and
[Yeast], Yes/No fields located in the subdatasheet table, are actively
checked, display only the contents of those that are checked. If there is no
matching subrecord, I want the msg: "This individual does not have any Exam
Data entered. Check if Exam Data is Available and Re-Run.†I want the
printing to be cancelled and return back to the {frmPatient Data}, without
any further updates.
Currently: 1) After pressing the Cmd Button, for those with a subrecord,
the data is displayed to include all 3 fields, regardless if they are
actively checked or not. The active fields should be displayed only if they
are actively checked. Upon closing, the [ResultsNotified] is automatically
updated which should be the case. 2) For those individuals without a
subrecord, the {rptLetter} is displayed for printing, which shouldn’t be.
The Msg Box does not appear at all. When closing, the [ResultsNotified]
field still gets automatically updated, creating a new record in the
subdatasheet table {Exam Data}which shouldn’t be the case.
Information: The {frmPatient Data} has a subform {frmExam Data}, table
source is {PatientData} and {ExamData} respectfully. The [SSN] is the link
between the 2 tables. The [SSN] is the Primary Key in the 1st table and
[ExamID] in the 2nd table. The 3 fields [Trichomonal], [Bacterial], and
[Yeast] are fields in the subdatasheet {ExamData} which are Yes/No fields.
The macro [UpdatePrintNotice] is attached to the Cmd Button “Print
Notificationâ€, “On Click†property, which has 2 actions:
SetValue: Item: [Forms]![frmPatient Data]![frmExam
Data]![ResultsNotified]; Expression: Date()
OpenReport: Report Name: rptLetter; View: Print Preview; Filter Name:
blank; Where Condition: [ExamData]![ExamID]=[Forms]![frmPatient
Data]![frmExam Data]![ExamID].
I noticed that there is a filter turned not on in the Property of the
{rptLetter}. The filter is: ([ExamData]![ExamID]=[Forms]![frmPatient
Data]![frmExam Data]![ExamID]) which is the same as stated in the Where
Condition of the macro above; and the next property Filter On: is “Noâ€. Does
this make sense!
I have a 2nd macro {ClearNotified} which I can not find where it is being
used in the database; it has 1 action:
SetValue: Item: [Forms]![frmExam Data]![ResultsNotified]; Expression: Null
Further, there is also a filter on the subform {frmExam Data} as: ((Not
Lookup_ResultsID.ExamResults1="WNL")); and Order by:
Lookup_Provider.Provider. I don’t know if this is affecting the error.