need help,,,,

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys,

I need a little help with my form:
I have main form in which I do som calculation and store the result in Main
subtotal field, and a second form in which also I do some calculation and
store the result in subtotal.
I need to pass the value from second form to Second subtotal field in main
form. And total will be the result of (Main subtotal) value + (Second
subtotal) value.

Thanx for any help in advanced,
 
You shouldn't be "storing" any calculated results. Use unbound controls and
make their control source the calculation formula that you need. If other
forms are left open, you can reference any value shown on them in the
expression on your other forms.
I.E. [myCalc1]= (Me.[price]*Me.[quantity])+Forms!myForm.[tax amount]

-Ed
 
Bashar,

The practice of storing ANY calculation is strongly advised against. It can
be calculated faster than looking it up, and you don't store something in a
table that could become inaccurate should someone change data in the table
outside the context of your form.

But, to refer to the value of a control on another open form:

=Forms![YourFormName]![YourControlName]

If this second form is not ANOTHER form, but a subform of your main form,
the syntax is:

=Forms![YourFormName]![YourSubformName].Form![YourControlNameOnSubform]

HTH
Sprinks
 
hi man,

Thanx for your help, but if I have multiple forms and in each form I do
calcultion for price and quantity, and in the main form the total field sum()
all the subtotal fields in the other forms.
the question I want to ask: must I open all the forms to put the results
into the total field?

Thanx againg,
 
Hi, Bashar.

Yes, to obtain the value in a form control, the form must be open. Without
knowing the details of what you're trying to do, you might consider, as an
alternate to separate forms, a single tabbed form, with subforms placed on
each tab.

Hope that helps.
Sprinks

Bashar said:
hi man,

Thanx for your help, but if I have multiple forms and in each form I do
calcultion for price and quantity, and in the main form the total field sum()
all the subtotal fields in the other forms.
the question I want to ask: must I open all the forms to put the results
into the total field?

Thanx againg,

Ed Robichaud said:
You shouldn't be "storing" any calculated results. Use unbound controls and
make their control source the calculation formula that you need. If other
forms are left open, you can reference any value shown on them in the
expression on your other forms.
I.E. [myCalc1]= (Me.[price]*Me.[quantity])+Forms!myForm.[tax amount]

-Ed
 
Hi Sprinks

Please tell me how can I use a single tabbed form, with subforms placed
on each tab? in my project.

Best Wishes,
 
Hi, Bashar.

Subforms are used primarily to display the many side of a one-to-many
relationship, such as Customers and Orders, but are also useful in dividing a
business function into manageable process "chunks", which sounds like what
you're trying to do. Then the user can concentrate on a single task
efficiently--you can put each task or series of tasks on a single tab.

I'm assuming that all of these forms have some common field such as
OrderNumber, or CustomerNumber, etc. that you can link them to the main form
by.

A Tab is simply another control; place it just as you would any other
control into the Detail section, however, start from a blank form. It looks
like a file folder on the Toolbox toolbar. Insert as many tabs as you like,
and set their Name (how to refer to the page in VBA) and Caption (what is
displayed on the tab to the user) properties.

On the first tab, place the desired fields for your main form. Be sure that
the linking field is part of the form's RecordSource, although you needn't
display it on the form.

Assuming the other forms are created, resize your edit window so that you
have access to the Database window, and drag the forms from the Forms tab and
drop them onto the appropriate tabbed page. If you have Wizards enabled,
Access will guess what the linking field is, if not, or if Access guesses
wrong, you can set it by changing the LinkMasterField and LinkChildField
properties of the subform.

What I often do is place all common information from the forms, or any
totals I wish to display in the form header or footer so that it is visible
from any tabbed page. This gives the form a consistent look, maximizes
access to information, and minimizes the number of editable fields per page.

Good luck. Hope that helps.
Sprinks
 
Back
Top