Calculation Question

  • Thread starter Thread starter sargum
  • Start date Start date
S

sargum

Hi,

I have an unbound text box control in a subform called "ml/sec/window".

The subform contains the fields that contain the "ml" and "sec" (i.e,
Volume and Time fields) values that I need to perform the calculation.
However, the subform does not contain the window info and I need to
pull that data from a completely different form. To solve this
problem, I could just add a field called "# of windows" to the subform
but it would be repetitive for the user to have to input this info
every time.


I have tried the following in Control Source with no luck:


=[Volume]/[Time]/Forms![Hydraulic Permeability]![# windows]


but I get a "Name?" error showing up as a return on the field.


Can anyone help me figure out how to get a value from a parent form to
complete my calculation? Note that as a test I did make sure that when

the control source just equals[Volume]/[Time], I do get a value so the
error really is coming from the second division clause of my
calculation. Also note that I have a relational database with parent
forms and subforms linked together by unique ID's.


Thanks in advance.


S
 
Hi,

I have an unbound text box control in a subform called "ml/sec/window".

The subform contains the fields that contain the "ml" and "sec" (i.e,
Volume and Time fields) values that I need to perform the calculation.
However, the subform does not contain the window info and I need to
pull that data from a completely different form. To solve this
problem, I could just add a field called "# of windows" to the subform
but it would be repetitive for the user to have to input this info
every time.


I have tried the following in Control Source with no luck:


=[Volume]/[Time]/Forms![Hydraulic Permeability]![# windows]


but I get a "Name?" error showing up as a return on the field.


Can anyone help me figure out how to get a value from a parent form to
complete my calculation? Note that as a test I did make sure that when

the control source just equals[Volume]/[Time], I do get a value so the
error really is coming from the second division clause of my
calculation. Also note that I have a relational database with parent
forms and subforms linked together by unique ID's.

One thing to consider is that data is *NOT* stored in Forms. It's
stored in Tables; the form is just a window. If this is a "completely
different form" then perhaps it's not open at the time you're running
the calculation; if it is open, how do you have any assurance that
it's on the right record?

I'd suggest that you use DLookUp to look up the appropriate [#
windows] value from whatever table it's in. I don't know from your
description how to identify what's "appropriate".

If there is a textbox named [# windows] on the mainform of which this
is a subform you should be able to use

/ [Parent]![# windows]

in your expression.

Note that using blanks and special characters like # in field and
control names is really not a good idea, and that Time is a reserved
word. You may want to consider changing these fieldnames!

John W. Vinson[MVP]
 
Hello,

Thank you to both of you for your suggesitons. However, I keep getting
"Name?" error. I tried just simply trying to set control source to the
following (I wasn't sure if I was actually supposed to write the word
"Parent" or insert the name of the parent form...I tried both ways):

Me.Parent![# windows]
Me.[Chip Info]![# windows]

When I leave the "Me" out, I get "Error" in text field instead of
"Name?"

I will heed your suggesiton about not inserting "#" into the field name
but I played around with other data fields but they too gave me similar
errors when trying to do a similar thing.

Please help! Thanks again.

S


John said:
Hi,

I have an unbound text box control in a subform called "ml/sec/window".

The subform contains the fields that contain the "ml" and "sec" (i.e,
Volume and Time fields) values that I need to perform the calculation.
However, the subform does not contain the window info and I need to
pull that data from a completely different form. To solve this
problem, I could just add a field called "# of windows" to the subform
but it would be repetitive for the user to have to input this info
every time.


I have tried the following in Control Source with no luck:


=[Volume]/[Time]/Forms![Hydraulic Permeability]![# windows]


but I get a "Name?" error showing up as a return on the field.


Can anyone help me figure out how to get a value from a parent form to
complete my calculation? Note that as a test I did make sure that when

the control source just equals[Volume]/[Time], I do get a value so the
error really is coming from the second division clause of my
calculation. Also note that I have a relational database with parent
forms and subforms linked together by unique ID's.

One thing to consider is that data is *NOT* stored in Forms. It's
stored in Tables; the form is just a window. If this is a "completely
different form" then perhaps it's not open at the time you're running
the calculation; if it is open, how do you have any assurance that
it's on the right record?

I'd suggest that you use DLookUp to look up the appropriate [#
windows] value from whatever table it's in. I don't know from your
description how to identify what's "appropriate".

If there is a textbox named [# windows] on the mainform of which this
is a subform you should be able to use

/ [Parent]![# windows]

in your expression.

Note that using blanks and special characters like # in field and
control names is really not a good idea, and that Time is a reserved
word. You may want to consider changing these fieldnames!

John W. Vinson[MVP]
 
John said:
Hi,

I have an unbound text box control in a subform called "ml/sec/window".

The subform contains the fields that contain the "ml" and "sec" (i.e,
Volume and Time fields) values that I need to perform the calculation.
However, the subform does not contain the window info and I need to
pull that data from a completely different form. To solve this
problem, I could just add a field called "# of windows" to the subform
but it would be repetitive for the user to have to input this info
every time.


I have tried the following in Control Source with no luck:


=[Volume]/[Time]/Forms![Hydraulic Permeability]![# windows]


but I get a "Name?" error showing up as a return on the field.


Can anyone help me figure out how to get a value from a parent form to
complete my calculation? Note that as a test I did make sure that when

the control source just equals[Volume]/[Time], I do get a value so the
error really is coming from the second division clause of my
calculation. Also note that I have a relational database with parent
forms and subforms linked together by unique ID's.

One thing to consider is that data is *NOT* stored in Forms. It's
stored in Tables; the form is just a window. If this is a "completely
different form" then perhaps it's not open at the time you're running
the calculation; if it is open, how do you have any assurance that
it's on the right record?

I'd suggest that you use DLookUp to look up the appropriate [#
windows] value from whatever table it's in. I don't know from your
description how to identify what's "appropriate".

If there is a textbox named [# windows] on the mainform of which this
is a subform you should be able to use

/ [Parent]![# windows]

in your expression.

Note that using blanks and special characters like # in field and
control names is really not a good idea, and that Time is a reserved
word. You may want to consider changing these fieldnames!

John W. Vinson[MVP]

Hi John,

Forgot to answer that the form is open when subform is open but good
point. The form is based on relationships between subforms and forms.


S
 
Hello,

Thank you to both of you for your suggesitons. However, I keep getting
"Name?" error. I tried just simply trying to set control source to the
following (I wasn't sure if I was actually supposed to write the word
"Parent" or insert the name of the parent form...I tried both ways):

Me.Parent![# windows]
Me.[Chip Info]![# windows]

When I leave the "Me" out, I get "Error" in text field instead of
"Name?"

I will heed your suggesiton about not inserting "#" into the field name
but I played around with other data fields but they too gave me similar
errors when trying to do a similar thing.

You also say:
Forgot to answer that the form is open when subform is open but good
point. The form is based on relationships between subforms and forms.

I'm sorry, but this makes no sense. Forms don't have relationships,
any more than they store data. Forms ARE JUST WINDOWS onto Tables and
Queries.

Some questions:

What is the name of the main form?

Is the subform really a Subform, in a Subform control box on the
mainform? Or is it a separate form that you are opening?

If it's a subform, what is the Name property of the subform control
(the box containing the form)? What's the name of the Form object
within that control (equivalently, the SourceObject property of the
Subform)?

What is the Name property of the textbox or other control on the main
form containing the field [# windows]? Is that in fact the name of the
table field?

John W. Vinson[MVP]
 
Hi Vince,

To make it clear, here is a summary of table relationships, which shows
links.

Wafer Info Table Chip Info Table Solvent Info Table Flow Info Table
---------------------- --------------------
------------------------ ---------------
Wafer Info ID-----> Wafer Info ID Solvent Info ID ---->Solvent Info
ID
Wafer Name Chip Info ID----->Chip Info ID Volume
(ul)
# windows Solvent
Time (sec)

Form Details:
I have a form that incorporates all of these tables. Flow Info is a
Subform of Solvent Info and Solvent Info is a Subform of Chip Info and
Chip Info is a Subform of Wafer Info.

I have an unbound field in Flow Info subform where I want its control
source to = Volume (ul)/Time (sec)/ # windows but # windows has to come
from what was entered in Chip Info subform. I can't get it to work,
even after I tried Me.Parent.[# windows] or Parent.[# windows].

Hope this helps clear things up. Thanks for working with me on this.

S
 
Ugggh, Tables didn't show proper formatting...here is another try.

Wafer Info Table
------------
Wafer Info ID*
Wafer Name

Chip Info Table
-----------
Wafer Info ID
Chip Info ID*
# Windows

Solvent Info Table
---------------------
Chip Info ID
Solvent Info ID*
Solvent

Flow Info Table
---------------------
Solvent Info ID
Volume (ul)
Time (sec)

*auto generated primary key

S
 
Ugggh, Tables didn't show proper formatting...here is another try.

Wafer Info Table
------------
Wafer Info ID*
Wafer Name

Chip Info Table
-----------
Wafer Info ID
Chip Info ID*
# Windows

Solvent Info Table
---------------------
Chip Info ID
Solvent Info ID*
Solvent

Flow Info Table
---------------------
Solvent Info ID
Volume (ul)
Time (sec)

*auto generated primary key

Ok, let me ask the relevant questions again:

What is the name of the main form?

Is the subform really a Subform, in a Subform control box on the
mainform? Or is it a separate form that you are opening?

If it's a subform, what is the Name property of the subform control
(the box containing the form)? What's the name of the Form object
within that control (equivalently, the SourceObject property of the
Subform)?

What is the Name property of the textbox or other control on the main
form containing the field [# windows]? Is that in fact the name of the
table field?

John W. Vinson[MVP]
 
Hi,

Ok, here are the answers to your question.
What is the name of the main form? [Wafer Info]

Is the subform really a Subform, in a Subform control box on the
mainform? [Yes] Or is it a separate form that you are opening? [No]
[More Form Details:
I have a form that incorporates all of these tables. Flow Info is a
Subform of Solvent Info and Solvent Info is a Subform of Chip Info and
Chip Info is a Subform of Wafer Info. ]
If it's a subform, what is the Name property of the subform control
(the box containing the form)? [Theoretically, I have 3 subforms, one named Chip Info (which links to Wafer Info which is the name of the main form), one named Solvent Info (which links to Chip Info subform) and one named Flow Info (which links to Solvent Info subform), see table relationships]
What's the name of the Form object
within that control (equivalently, the SourceObject property of the
Subform)? [I don't uneerstand this question, in general, all of the from names are named the same as the Table name)

What is the Name property of the textbox or other control on the main
form containing the field [# windows]? Is that in fact the name of the
table field? [Yes, it is simply called # windows]

Thanks.
S
 
Back
Top