Access 2007: Data type error using Val(string) expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am building a criteria expression and I'm using a Val(string) expression.
When I click Run, I am getting a data type in expression error. I have
confirmed that the field is of type 'text' and in fact all entries are
numbers coded as strings (not that it would matter if there was text).

Can someone please help?
 
I haven't played with 2007 but it looks like a references problems. What
happens if you go to the Immediate window and type in the following and hit
enter?

Debug.Print Val("123ABC")

If you get the same error, it's either a references problem or a bug in A07.
If you don't get an error, you need to look at your code a little closer.

Oh! Val chokes on null values so make sure there aren't any of them.
 
It was the null / blank / zero length string problem. I fixed it by doing a
find / replace but I had some difficulty with that too; it worked eventually
.... The problem was that when I do a Find/Replace for "", the first click to
the Find says none found, the second click however works! Ughhh. I have no
idea what made me try the second click - frustration?

Well, the important thing is that your advice in pointing me to the Null
worked. thanks!
 
Back
Top