how to display total price when button is clicked?

G

Guest

i have a problem here.
I have a form called [addOrder], there is a field called [Total_Ex_TAX] in
that form.
i also have an order_line subform that has the [total_line] filed. I
calculated the sum of the total_line by creating a query called [query1].
the probelm is: i need to display the sum of the total_line, whcih has
successfully done throu the [query1], in the [Total_Ex_TAX] when the button
[calculate_total] is clicked.
please help.
 
A

Allen Browne

Simplest way to do this is to show the total in the Form Footer section of
the subform.

1. Open the subform in design view.

2. Open the Properties box (View menu.)
Make sure you are looking at the properties of the form (not of a text box.)

3. Set the form's Default Display property to Continuous.

4. If you don't see a Form Header section above the detail, click Form
Header/Footer on the View menu.

5. Add a text box to the Form Footer section, and give it these properties:
Control Source: =Sum([Total_Ex_TAX])
Format: Currency
Name: txtSubTotal

You may need to rearrange the text boxes in the subform so they are side by
side. You may also want to cut their labels (Ctrl+X) and paste them into the
Form Header section (Ctrl+V) above the text boxes.

The subform will now show the total in the text box at the foot of the form.
You don't need to click a button: the total will update as soon as you save
a row in the subform.

(Note that you must not save the total in the main form's table. Post back
if you're not sure why.)

Also, Access 2007 can show the total at the foot of a Datasheet if you
prefer that view, i.e. in the new version you don't have to use Continuous
Form view to see the total.
 
G

Guest

thanx alot..that worked for me now...i am really appreciated

Allen Browne said:
Simplest way to do this is to show the total in the Form Footer section of
the subform.

1. Open the subform in design view.

2. Open the Properties box (View menu.)
Make sure you are looking at the properties of the form (not of a text box.)

3. Set the form's Default Display property to Continuous.

4. If you don't see a Form Header section above the detail, click Form
Header/Footer on the View menu.

5. Add a text box to the Form Footer section, and give it these properties:
Control Source: =Sum([Total_Ex_TAX])
Format: Currency
Name: txtSubTotal

You may need to rearrange the text boxes in the subform so they are side by
side. You may also want to cut their labels (Ctrl+X) and paste them into the
Form Header section (Ctrl+V) above the text boxes.

The subform will now show the total in the text box at the foot of the form.
You don't need to click a button: the total will update as soon as you save
a row in the subform.

(Note that you must not save the total in the main form's table. Post back
if you're not sure why.)

Also, Access 2007 can show the total at the foot of a Datasheet if you
prefer that view, i.e. in the new version you don't have to use Continuous
Form view to see the total.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

HelpPlease said:
i have a problem here.
I have a form called [addOrder], there is a field called [Total_Ex_TAX] in
that form.
i also have an order_line subform that has the [total_line] filed. I
calculated the sum of the total_line by creating a query called [query1].
the probelm is: i need to display the sum of the total_line, whcih has
successfully done throu the [query1], in the [Total_Ex_TAX] when the
button
[calculate_total] is clicked.
please help.
 

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