|
-
October 26th, 2011, 04:32 AM
#1
negative\postitive
hi
i want to be able to do this
when the amount coming in is positive if returns a c and if amount is negative it returns a d
this is what i have tried
Code:
If SNEX_ARRAY$(EXE_AMOUNT) < 0 Then
SNEX_ARRAY$(EXE_CD) = "d"
Else
SNEX_ARRAY$(EXE_CD) = "C"
End If
any ideas why it doesnt work
-
October 26th, 2011, 06:04 AM
#2
Re: negative\postitive
Hello,
very difficult to guess ..
Is SNEX_ARRAY$ a function receiving EXE_AMOUNT as a parameter ?
If so :
Show the complete function code
If not so (then it is an array) : explain (because I personnally would not undersatant "it returns ...")
-
October 26th, 2011, 08:29 AM
#3
Re: negative\postitive
SNEX_ARRAY$(EXE_AMOUNT)
The $ indicates the variable is a string. Possibly you need the value of this string
Try Val(SNEX_ARRAY$(EXE_AMOUNT))
-
October 26th, 2011, 09:55 AM
#4
Re: negative\postitive
You say it doesn't work, what does it actually do?
Always use [code][/code] tags when posting code.
-
October 26th, 2011, 10:47 AM
#5
-
October 26th, 2011, 01:24 PM
#6
Re: negative\postitive
Yeah been a while since I have saw a $ used on a variable name but as far as I know it still works in VB6. Used to be required back in the day.
Always use [code][/code] tags when posting code.
-
October 26th, 2011, 04:24 PM
#7
Re: negative\postitive
If SNEX_ARRAY$() is a string array, as may be supposed, the statement
If SNEX_ARRAY$(EXE_AMOUNT) < 0 Then
would certainly throw up a Type mismatch error.
Is that what you get?
-
October 26th, 2011, 09:24 PM
#8
Re: negative\postitive
Actually if the variable contains a numeric value then the code will work just fine in VB6. if the string contains -1 then it will be true if it contains 1 then it will be false. If the string contains a non numeric value it will trigger a type mismatch error but since the poster did not tell us what it is doing there is not much way to say what the problem is other than to point out that you should use numeric variables for numeric operations even though you can sometimes get away with string variables.
Always use [code][/code] tags when posting code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|