Link to home
Start Free TrialLog in
Avatar of cssc1
cssc1Flag for United States of America

asked on

How to duplicate values from one form to another?

The seven values (in unbound text boxes) on the footer of form "Root_H_P"  I want to duplicate in unbound textboxes on form "Annual Trend".

I have tried putting unbound textboxes on the "Annual Trend" with all types of formulas, but always get error mesaages.

See attached image for better description.
Duplicating-Values.jpg
Avatar of Eric Sherman
Eric Sherman
Flag of United States of America image

If both forms will always be open at the same time and these are not sub-forms ... Then set to Control Source of your Text Boxes on Form Annual Trend to something like .... Of course using your exact control names on Root_H_P.

= Forms!Root_H_P!TextControlNameHere

Do this for each of the seven controls using the correct control name.

ET
Avatar of cssc1

ASKER

Please see error
Error-101.png
Is [Human_H_T_frm] open??

ET
Try this method ...

=[form name].Form![control name]

ET
Avatar of cssc1

ASKER

See error attached
error-3.jpg
Is [Human_H_T_frm] open??

 ET
Avatar of cssc1

ASKER

no
When you refer to a control on another form, that form must be open as well.

Also, are these sub-forms on a main form by any chance.  If so the syntax will be different.  

Let me know.

ET
etsherman told you that BOTH forms needed to be open if you wanted to refer to controls on other than the currently active form.  Forms don't store data.  Tables store data.  It is only if a form is open and showing a record that you can refer to its controls AND you can only refer to the current record.

1. You should probably adopt some naming standards.  Having controls named Text218, Text 223, etc causes unnecessary brain strain and easily leads to errors as you have to look up the contents every time you need to reference a control.
2.  Since the controls are unbound, what is the problem with calculating them again?
Avatar of cssc1

ASKER

I don't have a problem calculating them again, however, I have two problems:

1. The form is not opened
2. I don't know how to write a quert expression the sums all TRUR check boxes for :1-Human Emgineering"
I'll say it again.  Forms don't store data.  Tables store data.  To do the calculations again, you would need to use the same data source used by the original form.  

One possibility is to use a single form with tabs.  Then the calculated fields can sit on the main form and you can use the tab control to switch to viewing a different subform.

A query that counts yes/no fields  uses Sum() to add up all the 0 and -1 values and converts the negative result to a positive:
Select abs(Sum(YourField)) As TrueCount
From yourTable;

But - I'm going to guess that you mean "sum" in the sense of an Excel function because your table is not properly normalized.  That would be:

Select abs(Nz(chk1,0)) + abs(Nz(chk2,0)) + abs(Nz(chk3, 0)) + ....  As TrueCount
From YourTable;

Relational databases do not support functions that operate on ranges of columns as Excel does because that would imply the table contains a repeating group and repeating groups violate first normal form so data is normalized by moving the repeating group to a related table where each row is the equivalent of a single option.
Can you load up a sample of your db.  We can answer specific questions but I generally do not respond when I have to try and guess what the person asking the question is trying to accomplish.  Keep in mind we are not seeing what you are seeing.

Sounds pretty easy but I need to see exactly where you are now.

ET
Avatar of cssc1

ASKER

I have attached a zipped copy of the actual application

THe log on info is:

Name: Admin
Pass: Admin

To see the info of the I am trying to duplicate click the "Event Root" menu button, see bottom of form.
I am trying to duplicate it and put the information on the "Annual Trend" form. Click the Trend button on the main screen.
RC-Ver-96.zip
Ok, I will review and respond.

ET
Ok, I had a chance to review your sample db.  The totals or summary dats is on [Root Causes - frm] sub-form which is closed when you are opening the [Annual Trend] Form.   I duplicated [Root Causes - frm] -> [Root Causes2 - frm] which just the totals and made it an invisible sub-form on your main form such that the formulas are calculated and ready when form [Annual Trend] opens.  The control source for the seven controls are shown below.

Human  Eng  =[Forms]![Main_Menu]![Root Causes2 - frm].[Form]![Text187]
Training  =[Forms]![Main_Menu]![Root Causes2 - frm].[Form]![Text210]
Communications =[Forms]![Main_Menu]![Root Causes2 - frm].[Form]![Text221]
Management Systems =[Forms]![Main_Menu]![Root Causes2 - frm].[Form]![Text216]
Work Direction =[Forms]![Main_Menu]![Root Causes2 - frm].[Form]![Text200]
Procedures =[Forms]![Main_Menu]![Root Causes2 - frm].[Form]![Text195]
Quality Control =[Forms]![Main_Menu]![Root Causes2 - frm].[Form]![Text224]


See attached fixed db.

ET
C--Users-Eric-Downloads-RC-Ver-96-RC-Ver
Avatar of cssc1

ASKER

what program do I use to open this program?
It' just a zip file.  If you are using Windows just right click the file and select Extract All or use something like WinZip.

ET
Try this one ...

ET
RC-Ver-96-Fixed.zip
SOLUTION
Avatar of cssc1
cssc1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you explain why you are closing the question???  

I think you just wanted to accept my last post and award the points.

Thanks,

ET
Avatar of cssc1

ASKER

sorry, yes I was trying to close the question, thanks
Avatar of cssc1

ASKER

It fixed my problem