You have many choices
of Active X controls available for use as a Calculator in your Access application.
Heck, you could also shell out to the Windows built in calculator, but why
would you want to put up with potential broken references, missing or deleted
files, and non standard Windows installations, when you can include everything
you need right inside the database you distribute to your users.
This is a 100% all Access solution that you include right in your database
and use just like any other form. Best of all you have the full source code,
so should you need to add new functionality, make it bigger, smaller, change
color, etc. you can.
To use the calculator in your own database, download the Zip file
CalculatorDemo for Access 2000 and later versions then:
1. Import the Form frmCalculator and the Module basCalculator
into your target database.
2. Copy a Command Button from the sample form frmCalculatorTest to your form.
Position it next to the text box you want to hook the Calculator up to.
When you are done it should look something like this.
3. Next hook up the Calculator to the text box by typing the following statement
=PopupCalc([txtTotalQuantity],"Enter Total Quantity") right in
the On Click Property of the command button. You can enter it directly on the
property sheet, you do not need to put any code behind the form to make this all work.
4. Change the first parameter ([txtTotalQuantity] in
the sample above) to the Name of the text box you want the Calculator
to be associated with, and change the second parameter ("Enter
Total Quantity" in the sample above) to the Caption you
want the Calculator to pop up with.
Add as many Command buttons as you need on the form and change the parameters
as necessary. That's it you are done. There is no additional code necessary.
When you click the command button the calculator will pop up below and just
to the left of the command button seeded with the current value and format of
its associated text box ready for use.
Clicking OK will place the calculators current value into its associated
text box and close the calculator. Clicking Cancel closes the calculator
without making any changes to the associated text box.
Enjoy RDub |