473,769 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Trichomon al <> 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.OpenRepor t 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 {UpdatePrintNot ice}, 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 [UpdatePrintNoti ce] 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_ResultsI D.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 2560
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******** *************@i 40g2000cwc.goog legroups.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.Trichomon al <> 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.OpenRepor t 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 {UpdatePrintNot ice}, 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 [UpdatePrintNoti ce] 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_ResultsI D.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
4264
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 the end. Private Sub txtCapability_GotFocus() ‘ Placed either behind the OnEnter or GotFocus Event of a control named, ' in this case, txtCapability, on a form ensures that when the control is
0
1996
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 ModuleID. Now this form takes in info from some fields (eg. track, gradyear), and automatically updates others (i.e. ID and ModuleID). But I need to find a way to update the ModuleID a certain way. Here's the deal. There are many types of students....
2
5333
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 to make it update when I tab out of that field? Thanks.
1
1098
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 arrive. I guess one way is to have the page reload every x seconds, but that it is not elegant at all. - Thanks!
7
3470
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 'UpdateRegistrant' expects parameter '@EMail', which was not supplied. The field value was null in the database and not changed in the FormView so is null going back into the stored procedure. I'm stumped and would greatly appreciate any suggestions.
9
76154
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 DAO Recordset although these Methods are equally applicable to ADO Recordsets. The following code will print all the Last Name () values in the Employees (tblEmployees) Table using all 4 of these Methods. Dim MyDB As DAO.Database, MyRS As...
4
6814
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
1848
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. I have two tables providing data for this - Table A contains information about the mailing itself, weight, number of recipients, etc. Table B contains information about the type of packaging - small, medium or large envelopes
1
4683
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 reporting (can't really go into too much detail...it's a legal application). Anyway, I always have to customize the field names every single time a production is to go out. The original field names are always the same, and the field names I want to...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.