By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,705 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,705 IT Pros & Developers. It's quick & easy.

Conditional update on a text box after onclick command from a Clickbox

P: 10
How can i make a code if i want the following...
1.0 OnClick event, another text box will be updated with value (lets say "thescripts" If the existing value on that text box is zero (0) but if the text box has any value or content it will simply set it to zero(0).
Dec 18 '06 #1
Share this Question
Share on Google+
3 Replies


missinglinq
Expert 2.5K+
P: 3,532
Jacko7289, you need to rephrase your posting to make your problem a little clearer.

It sounds as if when the command button is clicked, you want to check and see if your text box has a value of zero. If it does, you want its value changed to "thescripts". If it has any value other than zero, you want it changed to zero.

The logic of this aside, if the text box is bound to a field in an underlying table, you're talking about a field that is both numeric (zero) and text (thescripts) which is impossible.It can only be one or the other!

Perhaps if you could give us a clearer idea of what you're trying to accomplish we can help you.
Dec 18 '06 #2

P: 10
My apologies for being unclear...anyway, Its about my order form. This form includes a series of check box for every item and a corresponding text box for the item's price. What i basically want is that when a user selects the item (check the check box) a corresponding amount (hardcoded not from table or any other objects) will be shown on the item price text box and if the user deselects (uncheck the check box) the item price text box should show zero (0).

Hope this clarifies my inquiry. Thanks
Dec 18 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
My apologies for being unclear...anyway, Its about my order form. This form includes a series of check box for every item and a corresponding text box for the item's price. What i basically want is that when a user selects the item (check the check box) a corresponding amount (hardcoded not from table or any other objects) will be shown on the item price text box and if the user deselects (uncheck the check box) the item price text box should show zero (0).

Hope this clarifies my inquiry. Thanks
In the control of the textbox for the Item Price set the default value property to 0.

Now in the after update event of the check box you will need to add the code

Expand|Select|Wrap|Line Numbers
  1. If checkbox1 Then ' defaults to true (-1)
  2.    Me.txtItemPrice = <your calculation here>
  3. Else
  4.    Me.txtItemPrice = 0
  5. End If
  6.  
Mary
Dec 19 '06 #4

Post your reply

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