Using Code to respond to negative Values

sush

Registered User.
Local time
Today, 08:32
Joined
Feb 8, 2000
Messages
29
Hello,

I want to write an expression to say..

If a value is a negative value then change another field to say 'IN' if not say 'out'

I want to know how can i, in code decribe a negative value.


Can any body help?

thanks
 
Hello Sush,

If Not IsNull(Me.txtValue) Then
If Me.txtValue < 0 Then
Me.txtOtherValue="In"
Else
Me.txtOtherValue="Out"
End If
End If

This can work off an event, depending what you want to do. Here I've used text box values but you could substitute field values if you want.
Let me know how you get on.

Regards
Robin.
 
Hi Robin,

Thank you that does sort of work, but the problem is that i need to then export this information to a excel spreadsheet,

I will explain.

I have imported 2 spreadsheets i am then comparing the stock codes if they match i want deduct the quanties and then show the difference. The problem is that because the value holding a the 'In' or 'OUT' value is not a stored field when i try to export it the first value from the list is brought acroos them all, i am usign the IF statement on the Current record event.

what would be brill would be if i could do this in excel. Can i do something similar in excel??

thanks again
 
To my mind, the simplest way to do this is in a query, you would create an expression in the query such as:

Expr1: IIf([MyValue]<0,"In","Out")

(Where 'MyValue' is the name of the field that can be positive or negative)
You can then export the query results as a spreadsheet.

HTH

Mike

[This message has been edited by Mike Gurman (edited 09-28-2000).]
 

Users who are viewing this thread

Back
Top Bottom