473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Message Box Not Appearing and Field Updates Automatically

I am having a problem with the coding below that someone was trying to
help me with in another website. I have been to several websites and
hopefully here I can get it resolved. I inherited this database and
issue, and I apologize for a bit lengthy. The coding is located 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.Trichomonal <> True _
And Me.[frmExam Data].Form.Bacterial <> True _
And Me.[frmExam Data].Form.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

End Sub

My result I want is: when I press the Cmd Button on the {frmPatient
Data}, linked to the macro {UpdatePrintNotice}, 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, don't display. 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, including all 3 fields, regardless if they are
actively checked or not is printed. 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 "not on" in the Property of the
{rptLetter}. The filter is: ([ExamData]![ExamID]=[Forms]![frmPatient
Data]![frmExam Data]![ExamID]) which is duplicated 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. Any suggestions will be greatly appreciated. Thanks.

May 10 '06 #1
1 2524
Sorry, but IMNSHO, subdatasheets are a violation of relational database
design guidelines so I don't use them, or suggest their use, and, thus,
don't answer questions about them. Because they do not support error
handling, I do not use macros, except on rare occasions, the AutoExec and
AutoKeys macros.

Others take a different view on both subjects, and perhaps will be able to
assist you. I posted this just so you'd know that your post was not being
ignored.

Larry Linson
Microsoft Access MVP
"Curtis" <cu************@us.army.mil> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
I am having a problem with the coding below that someone was trying to
help me with in another website. I have been to several websites and
hopefully here I can get it resolved. I inherited this database and
issue, and I apologize for a bit lengthy. The coding is located 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.Trichomonal <> True _
And Me.[frmExam Data].Form.Bacterial <> True _
And Me.[frmExam Data].Form.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

End Sub

My result I want is: when I press the Cmd Button on the {frmPatient
Data}, linked to the macro {UpdatePrintNotice}, 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, don't display. 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, including all 3 fields, regardless if they are
actively checked or not is printed. 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 "not on" in the Property of the
{rptLetter}. The filter is: ([ExamData]![ExamID]=[Forms]![frmPatient
Data]![frmExam Data]![ExamID]) which is duplicated 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. Any suggestions will be greatly appreciated. Thanks.

May 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: NewBob | last post by:
Since Access automatically highlights all of the text in a text control (I use it to hold data from a memo field) when the control is activated, I've added the following code to put the cursor at...
0
by: Dave | last post by:
Hi, I'm creating a form based on a table. This table has fields including UniqueID (auto numbered and different for each entry), Track (3 different types), ClassYear (4 different years), and...
2
by: Rosy | last post by:
I have a sub-form(company name & address) that is connected to my contact listing. When I change the contact, it doesn't update the subform until I close the main form or refresh. Is there a way...
1
by: vermon | last post by:
Is there any way to make a web app that updates automatically when the server updates some flags? An example would be a web mail interface that automatically updates the new email count as emails...
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
9
ADezii
by: ADezii | last post by:
There are basically 4 Methods that you can use to access the values of Fields in Recordsets. For the purposes of this demonstration, I'll be using a Table called tblEmployees, a Field named , and a...
4
by: Laurahn | last post by:
How can i send from VB 2005 a null value to a image field on a database in SQL 2005
4
by: LesYeuxBrass | last post by:
I'm producing a database to calculate projected costs of our mailings in-house and am trying to introduce a formula which will determine what postage to apply based on envelope size and weight. ...
1
by: jaceyk | last post by:
Is it even remotely possible to update field names to the correct field name for the same table using a data definition query? We have a utility that spits out data in an Access database for use in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.