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

calcuation question 2

Status
Not open for further replies.

rclarke

Technical User
May 14, 2001
78
GB
Hi there again

Hope you are all well

Ok next problem on my database

we have boxes of potatoes put into our store say 24 of them

I have to fields in my store table 'box number'(the original number of boxes put in that store) and remainingboxes 'the boxes currently in that store'

The later field needs to be updated when boxes are removed from the store so the users know when that store is empty.

The way I went about it was to put an unlinked text box on the field set as a numeric field as is remainingboxes
then in the valid event i put in the folowing code

remainingboxes=remainingboxes-thisform.text1.value

whwn I run the form however it comes up with an opperand/operator mismatch

What am I doing wrong?

Thanks in advance

Rachel
 
Hi Rachel,

You need to say:

REPLACE remainingboxes with remainingboxes - thisform.text1.value

Jim


 
Did you try seeing if thisform.text1.value is actually numeric? I seem to recall that you have to convert the 'value' to a numeric value. ...

Ah, here's the problem. Curtesy of the Hacker's guide:

"Value's type for these controls is determined by the control's ControlSource, if there is one. If not, Value is character for text and edit boxes and numeric for spinners."

So you're used to having a numeric 'value' since you've been using textboxes with ControlSources and now you don't have a ControlSource so you get a character 'value'.

Dave Dardinger

 
You might also try putting a 0 (zero) in the value property for the test box. I think this sets the value to numeric without a control source.

.....Rich
 
I assume that you have in the form, the boxes issued as Text1. So the balance box tect box, hope it is named as Text2....
The Text1.Valid event shall contain the code,

If This.Value > remainingBoxes
= MESSAGEBOX("Issue Qty greater than balance Qty. ", ;
0+16,"Reenter again ! ")
RETURN .F.
ENDIF

ThisForm.Text2.Value = RemainingBoxes - This.Value
ThisForm.Text2.Refresh()
RETURN .T.

When the records for issues are updated,
REPLACE RemaingBoxes WITH RemainingBoxes - ThisForm.Text1.Value. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top