Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

calculations in bound text boxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
postman - 10 Mar 2005 23:53 GMT
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.
Allen Browne - 11 Mar 2005 03:26 GMT
The best solution is not to store all these in the table, but to use
calculated fields in a query.

The table should probably have just these fields:
   Sub Total    Currency
   Discnt        Double (formatted percent)
   Gst Rate     Double (formatted percent)
   Tendered    Currency

Then in your query, you can enter an expression like this into a fresh
column in the Field row:
   Discount Amnt: [Sub Total] * [Discnt]
and in the next column:
   Total:    [Sub Total] - ([Sub Total] * [Discnt])
and so on.

For more help with the basic idea, see:
   Calculated fields
at:
   http://allenbrowne.com/casu-14.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> 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:
[quoted text clipped - 24 lines]
>
> Thanks in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.