Update a data bound textbox with command button (1 Viewer)

shan_vba

New member
Local time
Today, 06:22
Joined
Mar 14, 2020
Messages
21
Hello all!
I have created a simple set of tables and a form attached to it... in one form it loads a value called quantity... and I have another text box added called "In" where user can insert a value there.... and a button to update... so when user has entered a value to this text box and hit the command button the quantity field should get updated. The text box names are "Quantity" originally quantity loads to that and "txt_qty" where user enters the "In" amount.... Can anybody please help... I'm really new to this
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:52
Joined
Oct 29, 2018
Messages
21,522
Hi. What did you want the quantity to update into?
 

shan_vba

New member
Local time
Today, 06:22
Joined
Mar 14, 2020
Messages
21
Hi. What did you want the quantity to update into?
Example say if the quantity is 600 and the In value is 200 the quantity should be updated to 800 when the command button is clicked..... (As it says 200 more added to that item)
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:52
Joined
Oct 29, 2018
Messages
21,522
Example say if the quantity is 600 and the In value is 200 the quantity should be updated to 800 when the command button is clicked..... (As it says 200 more added to that item)
Try:

Me.Quantity = Me.Quantity + Me.QuantityToAdd

Use the names of your Textboxes.
 

vba_php

Forum Troll
Local time
Yesterday, 19:52
Joined
Oct 6, 2019
Messages
2,880
guy,

don't forget to tell him how to put ""=box + box"" in a bound control, right? =) isn't that possible too, as a more effective process?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:52
Joined
Oct 29, 2018
Messages
21,522
guy,

don't forget to tell him how to put ""=box + box"" in a bound control, right? =) isn't that possible too, as a more effective process?
Effective? That depends. A =box + box doesn't get saved into the table, which if sufficient, then it could be effective. Otherwise, it doesn't provide what was requested by the OP (to update the quantity "field," let alone the requirement to "click a button"). However, I do plan on asking for an elaboration later on to find out the actual intent, so your suggestion might be all what is actually needed in the end. Thanks!
 

shan_vba

New member
Local time
Today, 06:22
Joined
Mar 14, 2020
Messages
21
Thank you guys for the reply I opened the code builder for the button and add the following code Me.Quantity.Value = Me.Quantity.Value + Me.txt_qty.Value and it worked....
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:52
Joined
Oct 29, 2018
Messages
21,522
Thank you guys for the reply I opened the code builder for the button and add the following code Me.Quantity.Value = Me.Quantity.Value + Me.txt_qty.Value and it worked....
Hi. Congratulations! Glad to hear you got it to work. Good luck with your project.
 

Users who are viewing this thread

Top Bottom