Link to home
Start Free TrialLog in
Avatar of fadyabuzuaiter
fadyabuzuaiter

asked on

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
Avatar of GRayL
GRayL
Flag of Canada image

are you in a form?
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
Avatar of fadyabuzuaiter
fadyabuzuaiter

ASKER

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
Avatar of Jeffrey Coachman
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
ASKER CERTIFIED SOLUTION
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
<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
ok thanks all for your reply