passing data, OpenArgs, still struggling

D

dlazenby

Posted question about "synchronizing forms" 2 weeks ago, but I think I was
asking the wrong question. Now focusing on OpenArgs but not getting it.
In simplified version:
One table (PatientTbl). PatientTbl has many demographic fields including
patient's name, DOB, SS#, etc. The primary key field is PtIDpk.
2 forms- (PtMainFrm, PtDemFrm), both with PatientTbl being the control
source. PtDemFrm would be what the user would see first, enter the
demographics (if it is a new patient) and then "jump" (button or hyperlink)
to the PtMainFrm. PtMainFrm would only have 2 or 3 fields common to the
PtDemFrm, like name, DOB. As the name implies the main form would be the main
focus with many subforms connected.
My problem- when going from PtDemFrm to PtMainFrm those fields (name, DOB)
are not updated. BTW, I would like for both forms to be open at the same time
if that is possible.
I think I should be using the OpenArgs technique but am getting nowhere.
Could someone give me some specifics, please?
I think it should be a possible with a button on the PtDemFrm. The user
clicks the button and the data for those fields is passed to the PtMainFrm,
even before jumping to the PtMainFrm. I am thinking the VBA code would:
first, save the record;
then, pass that data to the PtMainFrm;
then, (while still with the focus on the PtDemFrm), update/refresh the
PtMainFrm so that the user now sees that the new/different patient is on the
PtMainFrm.
Please advise.
 
J

John W. Vinson

One table (PatientTbl). PatientTbl has many demographic fields including
patient's name, DOB, SS#, etc. The primary key field is PtIDpk.
2 forms- (PtMainFrm, PtDemFrm), both with PatientTbl being the control
source. PtDemFrm would be what the user would see first, enter the
demographics (if it is a new patient) and then "jump" (button or hyperlink)
to the PtMainFrm. PtMainFrm would only have 2 or 3 fields common to the
PtDemFrm, like name, DOB. As the name implies the main form would be the main
focus with many subforms connected.

Normally one would NOT use *either* Subforms (which you are not doing;
subforms reside on the main form and need not be "opened") nor popup forms
(which is what you're doing) if you're just updating one table.

If you do use a Subform, then NO CODE IS NEEDED at all. Simply have a Subform
control on the mainform, and use ptIDpk as the Master/Child Link Field.

Better yet - if you're in fact keeping all this data in one table - simply
base your Form on PatientTbl, and put a Tab Control on it. Put the demographic
fields on the first tab page; another set of fields on the second tab page;
yet another set on the third, etc.

My biggest concern though is that it sounds like you have a LOT of fields. Any
table with more than 25 or 30 fields is very likely to be incorrectly
normalized. What are some of these "subforms"?

If you can clarify why you feel that you need several synchronized forms in
order to update *one single record* - please do; it can be done with some
difficulty (you'll get errors because two incompatible forms both have the
same record open). But I honestly think you're on the wrong track!

John W. Vinson [MVP]
 
D

dlazenby

John,
I appreciate your interest in the overall construction of my project but I
am afraid that we are going to get sidetracked here.
I in fact use subforms extensively in my project. As you probably can tell
it is a medical database. A main base table is the patient table. It has many
related tables all with 8-10 fields at the most. The main working form is the
PtMainFrm which uses tabbed controls and nested subforms.
Regarding, the demographics table, the patient for many things may only have
one of those (e.g., first name, middle name, last name, DOB, SS#). In my mind
a subform means that that related table has a one to many relation (I guess
it could be one to one) but that seemed more complicated.
Back to the subforms/related tables- The patient form as stated has
extensive use of tabbed controls and subforms. The base "layer" is the
patient form. The next layer (subform with tabbed control) is the Patient
Visit Form-based on the patient visit table (any one patient will have many
visits). The next layer involves many subforms on the Patient visit form such
as medications, diseases, operations, etc. Many of these are constructed to
employ lookup tables, and any topic (related table-one to many relation ,
subform) might be very detailed. For example, the medication table fields are
medication, dose, dose frequency, dose route, amount, reason). The same goes
for allergies, operations, family history, review of systems, physical exam,
etc.
So hopefully you can tell that the working interface is a big form with
extensive subforms setup with extensive tabbed controls.
So, back to why I want to do what I requested in my original post. On my
working "base" form (PtMainFrm) of the demographics I just want name (I was
actually going to concatenate that with a text box -last, first, middle,
suffix) and DOB. This would be in the form header section. I really don't
want to use a lot of real estate for this.
The patient demographic table/form (PtDemFrm) would be where I would enter
those above demographic fields. I would them pass those desired fields' data
(name, DOB) to the PtMainFrm.
It seems that a subform would not apply because of the one to many issue.
Also, I want some popup functionality for this particular form; I have never
been able to figure out how to have a pop up subform. I am relatively new to
Access (BTW, I am using Access 2007), so I am certainly open to suggestions.
Please advise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top