Solved

Simple Calculator for Access Form

Posted on 2004-09-24
6
646 Views
Last Modified: 2006-11-17
Is there a way to add a very simple calculator to an Access form?  I don't need one with memory, or anything fancy, just simple addition, subtraction, multiplication, and division.  Thank you for your help.
0
Comment
Question by:calguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12146638
Create a textbox on your form and put a button on the form that has this code:

Msgbox Eval(Me!MyTextBox)

The user can now type in something like:
2*3+5

into the textbox, and clicking on the button will give a message box with the result.
0
 

Author Comment

by:calguy
ID: 12146661
Thanks for the suggestion, but I'm looking for a graphical one.  Something where a user could use the mouse and click on the buttons.  Sort of like the one that is in Windows.

CalGuy
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 12146725
Then place a command button on your form.  For the OnClick event, have it load and run the Windows calculator.  The default installation location for the program is: "%SystemRoot%\System32\calc.exe"

Otherwise, you will have to create a separate form, program all the buttons, logic, etc.  It is a fairly straight-forward project, but it can be very time consuming (especially if you consider operator precedence).  Best to use what is already made available to you.
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:calguy
ID: 12146794
routinet,

True it may be time consuming, but I think, no I know that the person who uses the database would need the simplicity of having a built in calculator.  Something that could be added to the form.  I saw a download of a calculator built in Access but was unable to incorporate it into my database.  I know that it's a lot of programming and I think I have a handle on it but my main problem was how to have the textbox space over once a second number button was pressed.  I had it to where it would enter the correct number in the textbox when pressed, but as soon as another button is pressed it erased the first and replaced with the new number.  I'm currently using somthing like this:

Button 8 Code:

Me.calcwindow = "8"

Now I know that when the button is pressed with this code, it commands the "calcwindow" textbox to reflect the number 8.  My main problem is, how do I have it accumulate the numbers until I can get to the "+""-""/""X" buttons?
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 300 total points
ID: 12146831
Just use something similar to the method I suggested. That is:
Me.calcwindow=Me.calcwindow & "8"

As the user clicks the buttons, the textbox will show the whole expression, that is:
10+11+7*4

The "=" button can then just do this:
Me.calcwindow=Eval(Me.calcwindow)
0
 

Author Comment

by:calguy
ID: 12146885
This is what I was looking for.  It totally slipped my mind!!  I couldn't get the numbers to accumulate in the window and forgot about the "&" symbol....DUHHH!!!!

Thank you!

CalGuy
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question