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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

again the spinner

Status
Not open for further replies.

misulica

Programmer
Feb 8, 2003
43
RO
In the rows column of my table I have the numbers of some products.
In a sell form I have a textbox who shows step by step one of those numbers.From the spinner I select a number from 1 to 9.
What I want to do is to decrease one of those numbers with the number selected from the spinner, something like this:

IF thisform.text7.Value<=thisform.spinner1.value
REPLACE thisform.text7.Value WITH (thisform.txtbuc.Value-thisform.spinner1.value)
ELSE Error &quot;Number too big&quot;
ENDIF

The new number must be saved into the database and showed in the textbox.If the number selected by me is greater then the shown number in the textbox, an error message will appear.
Where do I do wrong and what I have to do?
Please save me.Thanks
 

It is difficult to see where the problem is.
I would use:
STORE thisform.txtbuc.Value-thisform.spinner1.value TO THISFORM.TEXT7.VALUE

But is there another problem with saving the value to the table? TABLEUPDATE() maybe?
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Just addressing the syntax problems:
Code:
IF thisform.text7.Value<=thisform.spinner1.value
   thisform.text7.Value = (thisform.txtbuc.Value-thisform.spinner1.value)
ELSE
   Messagebox(&quot;Number too big&quot;, 0, &quot;Please Note&quot;)
ENDIF
If the textbox is bound to the table, then that's all you should need to do.

Rick
 
Thank you guys,I use the code of rgbean, but the message didn't appeared.
The number in textbox is 1, I choose 2 in the spinner, normally the messagebox must appeared, but instead in the textbox appeared -1
 
Where are you putting this code? In the spinner's InteractiveChange event method perhaps?

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top