Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing a value 1

Status
Not open for further replies.

chaosguy

Programmer
Nov 5, 2005
45
VC
I have this form with a 3 text box. txtTotal, txtDeposit and txtWithdraw. I also have a table call "Credit Card" that has one field "Card amount" with a value in it.

What I need my form to do is in the txtTotal, display the value in the table.
The user will be able to type in either an amount in the deposite field, in that case, when they hit the generate button next to the text box, it will take the amount entered and add it to the tblCard_Amount total. If they type in a withdrawal amount and hit generate next to that text box, well u subtract that amount from the total.
I have no idea how to program this or if it can be done. would really appreciate any help given :d. thank u
P.S - I don't know much about Access forms, and I don't know much about programming Visual. Please help if ya can.



Chaosguy - To die would be an awefully big adventure.
 
Hi Chaosguy

Make your "Credit Card" table the RecordSource of your form.

Make the "Card amount" field the Control Source for your txtTotal field.

Stick some code behind the Generate button, in its OnClick event, something like
Code:
Me!txtTotal=Me!txtTotal+Me!txtDeposit-Me!txtWithdraw

Easy - but all this is doing is changing a value in a table. If you want to record those changes, i.e. record each deposit and withdrawal transaction, then you will need more tables and a different method.

Regards

Mac
 
thanks you so much maccaillean. That worked just fine. That was such a simple solution tho, I feel bad having to ask about it now, :(, lol. But thanks anyways and take a star. Also do anyone or u know how to clear the text box after i have finished well updatign the balance. I got like a msgbox to say well the deposit went true, and the total changes, but it might still be confusing to the user is the deposit amount is still in the field. So is there like something i can put like

clear(me!deposit), lol or something. thanks again in advance.

Chaosguy - To die would be an awefully big adventure.
 
Hi chaosguy - in the same OnClick event for the Generate button, after the code we've already discussed you can add something like...
Code:
Me!txtDeposit=0
Me!txtWithdraw=0
Regards

Mac
 
oh right, thanks alot man, u helped alot.

For those of u that might have somethign simular to thjis, here's the code i used, or developed. For the Deposite button tho :D. ok, so hope it helps all ya future surfers. thanks alot mac, and i gaved ya a star.

Private Sub Deposit_butt_Click()
If IsNull(Me.deposit) Then
MsgBox "You must enter a value in the field. Please enter the deposit amount"
Else
Me!Total = Me!Total + Me!deposit
MsgBox "You have deposited " & Me!deposit & " dollars to your credit card"
Me!deposit = 0
End If
End Sub



Chaosguy - To die would be an awefully big adventure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top