Link to home
Start Free TrialLog in
Avatar of bar0822
bar0822

asked on

Error on nulls with Left Mid() function

this function in Access produces an error on nulls in the column:
Left(Right(,Len()-InStr(),"(")),Len(Right(,Len()-InStr((),"(")))-1) - how can this be rewritten so that it will convert nulls into empty strings?  

Also, will this work in SQL 2005?  thanx
ASKER CERTIFIED SOLUTION
Avatar of Andrew_Webster
Andrew_Webster
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I hate to say this, but your expression has many issues.  For starters, your InStr() functions have no arguments ... which is your first issue.  Next, Your Right() function syntax is incorrect.  

Left(Right(,Len()-InStr(),"(")),Len(Right(,Len()-InStr((),"(")))-1)


Left(Right(,Len()-InStr(),"(")),Len(Right(,Len()-InStr((),"(")))-1)

Please look these up in VBA Help to get the correct syntax ...

mx
"bar0822 declined to include the actual strings and/or fields used in the expression and in doing so"
I see. Just to make it a trick question.
@JDettman:
"Nice to see you wanting to go the extra mile here,"
Huh?  Not related.
I agree with everyone!  Yes, the expression is a mess, and a royal pain to debug.  But the question was about how to convert Nulls to empty strings, and that was the answer given.

If I was stuck with that expression, I'd probably write a VBA function to clean it up, and call that from a query.  But even that might depend on the performance, as if it's in a query that hits many rows then performance could be a dog.

But I'm not going to go into "what ifs" or I'd drive myself nuts.  More nuts.