calculations in bound text boxes

P

postman

where can I make calculations in bound text boxes on a form work,
I'm building a cash register form with these text boxes bound to a table:

SUB TOTAL
GST
DISCNT (is a combo box with 'value list' row source: .1;.15;.20;.25;.50)
DISCOUNT AMNT
TOTAL
TENDERED
CHANGE.

If I have these form text boxes 'unbound' then its simple to make it work
with the following calculations in the corresponding control Source of the
text boxes:

SUB TOTAL (1st data input)
GST=[Total]*0.1
DISCNT 10% (.1) / 15% (.15) / 20% (.20)
DISCOUNT AMNT=[SUB TOTAL]*[DISCNT]
TOTAL=[SUB TOTAL]-[DISCNT AMNT]
TENDERED (2nd data input)
CHANGE=[TENDERED]-[TOTAL]

Tabbing through the boxes after data inputs makes the calcs work.
I have tied using the SQL design view but does not seem to work.
Where do the calculations go if controls are bound?

Thanks in advance.
 
M

Mike Painter

postman said:
where can I make calculations in bound text boxes on a form work,
I'm building a cash register form with these text boxes bound to a
table: SUB TOTAL
GST
DISCNT (is a combo box with 'value list' row source:
.1;.15;.20;.25;.50) DISCOUNT AMNT
TOTAL
TENDERED
CHANGE.

With the exception of the discount and tendered all those fields should be
calculated and not bound to a field on a table.

If you do place them in a field it would be done after the calcualtions and
Me!Total = your calculations is what you would use in some event.
 
P

postman

They do work better unbound, but how do I then record the data for the
transaction, would I use an append query?, thought they only work on tables.

Sorry I do not quite follow your bound option, could you elaborate please.

Thanks
 
M

Mike Painter

You should always use queries for your forms and reports and in this case at
least never store the values in the tables.
If you store the values, make a change someplace and forget to update the
stored information there will be errors.
 
P

postman

Ok Mike I get the idea, but how to implement append query from unbound text
boxs is mystery to me.
I really need this to work.
I would have thought from the sql design grid invoke?
Anyone else with good ideas appreciated.

Thanks.
 
M

Mike Painter

postman said:
Ok Mike I get the idea, but how to implement append query from
unbound text boxs is mystery to me.
I really need this to work.
I would have thought from the sql design grid invoke?
Anyone else with good ideas appreciated.

Thanks.

You don't get the idea if you still insist on stuffing the data into fields
in a table.

If you insist on doing that then no append query is needed.
Make sure the fields you want to use are included in the query you base your
forms on. (If you don't want to use a query you will have to write much more
code.)
In an approiate event, either at the field level or the form level you add
the following line or lines as needed.

Me!YourFieldName = your calculations
Me!discount = Me!yourPrice * me!yourdiscountamount.
 
P

postman

You don't get the idea if you still insist on stuffing the data into
fields in a table.
Take it easy Mike... I am going the query approach...I don't insist on
"stuffing" data into fields in any table!!! OK, where the fu*k did you get
that impression?
 
M

Mike Painter

postman said:
Take it easy Mike... I am going the query approach...I don't insist on
"stuffing" data into fields in any table!!! OK, where the fu*k did
you get that impression?

When you asked about using an append query from unbound text boxes.
 

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