473,473 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Access, calculator control

32 New Member
Hi,

I have a front screen till system which subtotals and runs fine. What i wish to do is the following:-

When the subtotal button is pressed a screen opens with the balance due, along with buttons numbered 1,2,3,4,5,6,7,8 and 9.

As each button is clicked, the "change due" or "outstanding balance" is shown.

There is no need for this data to be stored anywhere, its just a calculation.
May 10 '07 #1
22 6179
JConsulting
603 Recognized Expert Contributor
Hi,

I have a front screen till system which subtotals and runs fine. What i wish to do is the following:-

When the subtotal button is pressed a screen opens with the balance due, along with buttons numbered 1,2,3,4,5,6,7,8 and 9.

As each button is clicked, the "change due" or "outstanding balance" is shown.

There is no need for this data to be stored anywhere, its just a calculation.
so you will have a balance textbox..and when they click on a number, it subtracts from that? what if the user wants to subtract 20?
May 10 '07 #2
micksitup
32 New Member
the reason for the numbers 0 to 9 is not to limit their choice. Its because it will be operated on a touch screen system.

if the transaction value is £17.67, the user types 20, then a button called "tender", which in turn shows the difference between the two. The user can then click the screen to end the transaction
May 10 '07 #3
JConsulting
603 Recognized Expert Contributor
the reason for the numbers 0 to 9 is not to limit their choice. Its because it will be operated on a touch screen system.

if the transaction value is £17.67, the user types 20, then a button called "tender", which in turn shows the difference between the two. The user can then click the screen to end the transaction

This sounds fun. Just FYI, you didn't have 0 in your question.

So...first thing. Push the button to open the calculator

You will want to pass the balance to the new form. So we can do that with the opening arguement.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command2_Click()
  2. DoCmd.OpenForm "frmCalculator", acNormal, , , acFormReadOnly, acDialog, Me.MyBalance
  3. End Sub
  4.  
Now the calculator form itself.

I created an on_open event to load the balance

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Me.Balance = OpenArgs
  3. End Sub
  4.  
I created two textboxes. One called Balance, the other called Entry

I used the Format property and set them to Euro (Dollars/Pounds)

I created 10 buttons..called b1, b2, b3, etc...their captions 0-9. In each on_click event in the properties box, I put this call to the function...changing the number to the button's number
Expand|Select|Wrap|Line Numbers
  1. =myval(1)
  2.  
I created a function in the calculator form module (VBA)
Expand|Select|Wrap|Line Numbers
  1. Function MyVal(lnIn As Long)
  2. If Len(Me.entry) > 1 Then
  3. Me.entry = Replace(Me.entry, ".", "") & lnIn
  4. Me.entry = Left(Me.entry, Len(Me.entry) - 2) & "." & Right(Me.entry, 2)
  5. Else
  6. Me.entry = Me.entry & lnIn
  7. End If
  8. End Function
  9.  
I created 2 command buttons (I think you'll need a third to close the calculator too, but that one is easy)

Expand|Select|Wrap|Line Numbers
  1. Private Sub calc_Click()
  2. Me.Balance = Me.Balance - Me.entry
  3. Me.entry = ""
  4. End Sub
  5. Private Sub clear_Click()
  6. Me.entry = ""
  7. End Sub
  8.  
I made the form look like a calculator..and it still needs code so that when you close it....it updates the balance...but I need more info about how you want that to work.

This should get you going.
J
May 11 '07 #4
micksitup
32 New Member
Fantastic, think i understand, but to double check, heres something that i hope helps ut get closer.

1 form with all buttons for stock items, a sub form with a reciept (as you click its description and quantity tally up as you go.

another subform on the main form with the balance, which updates after each selection.

so with this in mind i would like the following to occur.....

1. When subtotal is clicked, a form (over unclosed button form) opens. (easy enough to do)

2. This form has the balance on one side (shown as a negative value which i guess would be achieve by subtracting its value twice from itself, but not sure how to do this)

3. The user selects the numbers which make the amount tendered, and clicks "tender"

4. Another form opens, showing the change due, and a button which will save and close the transaction
May 11 '07 #5
micksitup
32 New Member
Private Sub Command2_Click()
DoCmd.OpenForm "frmCalculator", acNormal, , , acFormReadOnly, acDialog,

Me.MyBalance

End Sub


it doesnt understand me.mybalance.

I have implimented all the code you gave, and hopefull close to getting this to work
May 11 '07 #6
JConsulting
603 Recognized Expert Contributor
Private Sub Command2_Click()
DoCmd.OpenForm "frmCalculator", acNormal, , , acFormReadOnly, acDialog,

Me.MyBalance

End Sub


it doesnt understand me.mybalance.

I have implimented all the code you gave, and hopefull close to getting this to work
me.mybalance was the field I was using to hold my balance. IT is passed as a value to the frmCalculator when it opens.

Where again is your "balance" field? and is it on your main form or your subform?
J
May 11 '07 #7
JConsulting
603 Recognized Expert Contributor
Fantastic, think i understand, but to double check, heres something that i hope helps ut get closer.

1 form with all buttons for stock items, a sub form with a reciept (as you click its description and quantity tally up as you go.

another subform on the main form with the balance, which updates after each selection.

so with this in mind i would like the following to occur.....

1. When subtotal is clicked, a form (over unclosed button form) opens. (easy enough to do)

2. This form has the balance on one side (shown as a negative value which i guess would be achieve by subtracting its value twice from itself, but not sure how to do this)

3. The user selects the numbers which make the amount tendered, and clicks "tender"

4. Another form opens, showing the change due, and a button which will save and close the transaction
I think the form open in your case would pull your amount off the subform?

so if you're opening the 2nd form from a button on your main form..you need to change the "openargs" in the form open statement to reference that field on the subform

me.subformname.form.fieldname where your names apply

J
May 11 '07 #8
micksitup
32 New Member
the actual form holding the information is a subform, but its as an expression, so its name is expr1. I have tried this but no joy
May 11 '07 #9
JConsulting
603 Recognized Expert Contributor
the actual form holding the information is a subform, but its as an expression, so its name is expr1. I have tried this but no joy
show me what you've tried....that way I can help you.
J
May 11 '07 #10
micksitup
32 New Member
ok here goes.

all buttons that create transactions are on 1 page "frm_add_transaction", nothing subbed with regards to buttons.

A sub form "fsub_reciept" is on "frm_add_transaction".

"fsub_subtotal" is a subform also on "frm_add_transaction".

"fsub_subtotal" is made using the following query

tbl_transaction_product.product_id, tbl_transaction_product.quantity (COUNT), tbl_products.value (COUNT), AS expr1 (Sum([Quantity]*[Value])

-----------------------------------------------------------------------------------------------------------------

There is a page of buttons labelled 0,1,2,3,4,5,6,7,8,9. All code has been inplimented, except for the module for the calculator page (as i dont really understand what you asking.


would it be easier if i emailed the db to you? its in 07 format
May 11 '07 #11
JConsulting
603 Recognized Expert Contributor
ok here goes.

all buttons that create transactions are on 1 page "frm_add_transaction", nothing subbed with regards to buttons.

A sub form "fsub_reciept" is on "frm_add_transaction".

"fsub_subtotal" is a subform also on "frm_add_transaction".

"fsub_subtotal" is made using the following query

tbl_transaction_product.product_id, tbl_transaction_product.quantity (COUNT), tbl_products.value (COUNT), AS expr1 (Sum([Quantity]*[Value])

-----------------------------------------------------------------------------------------------------------------

There is a page of buttons labelled 0,1,2,3,4,5,6,7,8,9. All code has been inplimented, except for the module for the calculator page (as i dont really understand what you asking.


would it be easier if i emailed the db to you? its in 07 format
I wouldn't have any way of opening an 07 database...however, to clarify what I am asking.

we're transferring the balance from one form to another. Now you may have already done that?? the openargs option in the open form command is what I was using for that.

When the "0-9" form opens...I was using that to set the value of the balance. Then, when I entered the numbers and clicked the button, it would subtract the amount entered from the amount in that balance field, thus producing the difference.

Are you able to use any of the code samples I provided?
J
May 11 '07 #12
micksitup
32 New Member
it wont let me past the me.mybalance. maybe becuase this is an expression?

I have converted the file to access 03 and stripped it down.



im sorry if im a bit testing, but im very new to this
May 11 '07 #13
micksitup
32 New Member
i have just had a look through the code, but it seems that anything with a ME in it, simply wont work.

I really do appreciate your help on this
May 11 '07 #14
JConsulting
603 Recognized Expert Contributor
i have just had a look through the code, but it seems that anything with a ME in it, simply wont work.

I really do appreciate your help on this
I'm working in Access 2000. I'll see if I can dig up some references about me. for your version. Not sure why it's doing that. I have 0 experience developing in Access 2007. I understand it's very different.

I'm also at work at the moment...coming out here when I get a few free minutes. Is there a way you can convert your DB down to access 2000?

J
May 11 '07 #15
MMcCarthy
14,534 Recognized Expert Moderator MVP
Sorry to butt in. Something struck me when reading this. Are you sure the Me references are coded on the actual form they refer to? Otherwise you will have to use the full forms reference. Me simply stands for "this form".

Mary
May 12 '07 #16
micksitup
32 New Member
The code is exactly the same, it just seems to be cosmetic.

They can all be easily converted for backward compatibility
May 12 '07 #17
micksitup
32 New Member
Is there any chance we can start again with this as im getting quite confused.
May 12 '07 #18
MMcCarthy
14,534 Recognized Expert Moderator MVP
Is there any chance we can start again with this as im getting quite confused.
OK post the code that is causing you the initial problem and say what the code is doing.
May 12 '07 #19
micksitup
32 New Member
Its all in the body of this post
May 12 '07 #20
MMcCarthy
14,534 Recognized Expert Moderator MVP
Its all in the body of this post
You are the one who said you were confused and wanted to go back to the beginning. I'm only trying to assist.
May 12 '07 #21
JConsulting
603 Recognized Expert Contributor
i have just had a look through the code, but it seems that anything with a ME in it, simply wont work.

I really do appreciate your help on this

Hey,

I'm curious...inside your code (before we started)...how are controls (textboxes, listboxes, checkboxes) how are they referenced now?

I could not find any references for Access 2007 stating that that particular method of referring to a form is no longer available.

I Want to help you get this going...so can we recap?

1. You have a main form..
2. You want another form to open when you click on a control
3. you want to be able to enter numbers (which display in a textbox) and this textbox is different than the one that displays the "balance"
4. you press a button and that number you entered is applied against the "balance" and the balance is adjusted, the form closes, and that value is returned to your main form.

Please run that down and let me know if it's correct, and what...if any code you have that's in place for it (working or not)
J
May 12 '07 #22
JConsulting
603 Recognized Expert Contributor
Is there any chance we can start again with this as im getting quite confused.
Attempting to attach a zip file.
Attached Files
File Type: zip Calculator.zip (27.4 KB, 279 views)
May 12 '07 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Pete | last post by:
Is there any possiblity of writing an Access or Visual Basic application that provides a method of sharing the window focus between Access and the Shell application? i.e....
6
by: Rafael | last post by:
Hi Everyone, I need some help with my calculator program. I need my program to do 2 arguments and a 3rd, but the 3rd with different operators. Any help would be great. Here is my code.... ...
3
by: Paul | last post by:
I want to make a simple calculator program but dont know where to get started. This is not GUI but a simple terminal program. It would get input like this Enter number: 5 + 10
9
by: Rodrigo Ferreira | last post by:
I'm developing a user control with a textbox inside. When i write something like this: 123 + 456.456 + 456 / 453 * 45 + 4.155 and press ENTER, the control must have to show the result. I...
4
by: Raj Chudasama | last post by:
I have a controls similiar to the windows calculator. (Please press some buttons on your calculator to see what i am talking about) So when u hover over a button it will change the state (it...
1
by: Davids | last post by:
ok this is basic but it really puzzles me. I have an .aspx page and within it a user control (for example mycontrol.aspx and it's code file mycontrol.aspx.cs). In the code for my base page I...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
19
by: TexasNewbie | last post by:
This was originally just a calculator without a decimal point. After I added the decimal, it now tells me invalid second number. //GUI Calculator Program import javax.swing.*; import...
1
by: maarif | last post by:
Hi, I am looking for a calculator control for my web application in VB.NET (VS 2005). Is there any Infragistics control like UltraCalculator, UltraCalculatorDropDown for web applications? --...
3
by: mandy335 | last post by:
public class Calculator { private long input = 0; // current input private long result = 0; // last input/result private String lastOperator = ""; // keeps track of...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.