auto populate a 'totals' box

lxh

Registered User.
Local time
Today, 18:48
Joined
Feb 26, 2004
Messages
43
auto populate a 'totals' box - New posting from replies

Hi All

Can Somebody tell me how I can automatically fill in a value on a form (and table?). I have several fields that record a length of time in hours on seperate forms. The final value is just the sum of all the other values. I'd like it to be automatically filled in, in real time. The form which has the final value on it has two other values which need to be added to it too. So I can't use the on focus event.

Thnaks for any help
Lex
 
Last edited:
Base your form on a query...

Pat Hartman said:
...Base your form on a query...

Select fldA, fldB, Nz(fldA,0) + Nz(fldB,0) As SumFld
From YourTable;

OK, sounds great, but how do I base a form on a query?
 
Form from query

Just as you based your form on a table!! It really is that simple, no tricks. Queries allow you to create a single form from joining multiple tables and do all sorts of calculations etc....... In this insatnce create a new query, base it on the table for which you posted this thread an dthen add a filed to do your calculation (whatever is required) Have a look at the Northwind DB (if you don't have it there is a copy on the DB repository). An example of what you might require is:

Code:
Subtotal: Sum(CCur([UnitPrice]*[Quantity]*(1-[Discount])/100)*100)
Hope it helps.......................
 
will give it a go!

scouser said:
Just as you based your form on a table!! It really is that simple, no tricks.

Hope it helps.......................


OkaY great, thanks alot - I'll give it a go later to night (after work) - Thanks for everyones help.
Lex
 
autopopulating a totals box?

Hi

I've managed to base a form on a query and the totals box works - but does this mean I have to a subform for every totals box on my original form as the form is necessarliy based on a table as well?

is it more efficient to do in VB and how would that be done?

thanks
Lex
 
Thanks Pat

Thanks Pat thats great.

Lex
 

Users who are viewing this thread

Back
Top Bottom