Access 2010

Hello
i have a database on access 2010 .  i want to create a button when i click on it it should add the value from one text field to other text field .

note : the two text field takes data from the a numbers tables .

how i can make it .

thanks alot
fadyabuzuaiterAsked:
Who is Participating?
 
MINDSUPERBCommented:
Use this code:

Private Sub Command45_Click()
Me.Balance = Me.Balance + Me.[last add]
End Sub

Ed
0
 
GRayLCommented:
are you in a form?
0
 
MINDSUPERBCommented:
I assume that you have another unbound text field to capture the sum of the two fields. If my assumption is right, you may use the code below:

Private Sub cmdSum_Click()
Me.txtSum = Nz(Me.txtField1, 0) + Nz(Me.txtField2, 0)
End Sub

txtSum is the unbound field.

Sincerely,
Ed
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
fadyabuzuaiterAuthor Commented:
Hello
please check the attachment file
the form Student Form & the table name student .
i want to add a number to add account value then when i pressed the add buttom it should add it to the current account .


Student-DB.accdb
0
 
Jeffrey CoachmanMIS LiasonCommented:
Doing this with a button is awkward...

What if the use forgets?
What if the use clicks more than once...?

Doing this would also seem to create a "Hardcoded " value.

If It were me, I would create this "Calculated field" in the Recordsource and simply drop it into the form like any other field.
(This would also make it easy to have this value in the Report)

Modified sample attached
Student-DB.accdb
0
 
fadyabuzuaiterAuthor Commented:
THanks alot for your reply guys .
and there is a one problem still after the buttons work ..

i want to add a field for search in the Student form and it i want to make it when i type a letter it should give me the names with the starting with this letter .

in the attachment the last file modified .

Student-DB.accdb
0
 
Jeffrey CoachmanMIS LiasonCommented:
<i want to add a field for search in the Student form and it i want to make it when i type a letter it should give me the names with the starting with this letter . >

This appears to be a separate, new issue than the original question.
The rules of this site require one distinct question per post.

You should accept the post(s) that resolved your original issue as the solution here.
Then this new issue should be posted as a new question.

;-)

JeffCoachman
0
 
fadyabuzuaiterAuthor Commented:
ok thanks all for your reply
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.