If statement value

edojan

Registered User.
Local time
Today, 12:33
Joined
Dec 19, 2006
Messages
26
Hi

here is the code it returns value of "-1" how can i change this to lets say "*"?


Code:
'Examiner ID
If OP_ID.Value <> "" Then
    strWhere = strWhere & "AND (Operator_ID = '" & OP_ID.Value & "') "
End If
'strwhere is just dim string ...
 
The value is the value of OP_ID. I'm not sure what OP_ID is, so I can't help you as to why it's returning that value.

Seems to me, it'd be best to do an if "-1" then "*" or set the OP_ID.value inside strWhere as a variable so that it's easier to control, but I don't think I have nough information to help ya out more than that, someone else maybe able to.
 
OpID is just a field on a form ... basically if left blank it return null value since its text field.
In the If statement it returns -1 ... why? how can i change it?
i hope this makes sense.
 
Try doing .text instead of value.

Or if that doesn't work, leave off value and text all together and see if it works then.
 
that didn't work ... how would i do this below?


Dim strwhere as string

If OP_ID is null then then
op_id = *
strwhere= OP_ID
Else OP_ID = op_id.text

Is this better?
 
Well:
Code:
 If isnull(OP_ID) then
   op_idvariable = "*"
else 
   op_idvariable = OP_ID
end if
strWhere = text '" & op_idvariable & "' text"

I guess I still don't understand why OP_ID value and/or text is showing to be "-1" instead of text. Oh well, see if above solves your problem.
 
It is showing -1 because it is evaluating to a truth value of TRUE.

The expression is improperly bracketed by quotes so is being evaluated at the wrong moment during your processing.

I am going to assume you want to concatenate some form of this string onto the tail end of you WHERE clause.

"AND (Operator_ID = '" & OP_ID.Value & "') "

I don't see it offhand, but that "-1" is the flare-lit tip-off that something is being evaluated BEFORE you try to concatenate it.
 

Users who are viewing this thread

Back
Top Bottom