syntax for number?

Local time
Today, 08:45
Joined
Jun 27, 2007
Messages
246
this is not right, as it doesnt work:
Code:
strWhere = strWhere & "TSP.[CEAID] = #" & ctl.ItemData(varItem) & "#" & Chr(32) & " Or """

I put a watch on strWhere, and it shows up as

Code:
 WHERE TSP.[CEAID] = #7#

I just want to flag ctl.ItemData(varItem) as a number, so I dont get the 13 mistype error.

But I'm doing it wrong :(
 
this is not right, as it doesnt work:
Code:
strWhere = strWhere & "TSP.[CEAID] = #" & ctl.ItemData(varItem) & "#" & Chr(32) & " Or """

I put a watch on strWhere, and it shows up as

Code:
 WHERE TSP.[CEAID] = #7#

I just want to flag ctl.ItemData(varItem) as a number, so I dont get the 13 mistype error.

But I'm doing it wrong :(

The character "#" is normally used to surround a date, while the character "'" is used to surround a string. No special character is needed for a number. Try removing the "#".

The end of the string probably needs to be restructured as well:
"#" & Chr(32) & " Or """
Probably should simply be
" Or "
 
Last edited:
This:

Code:
strWhere = strWhere & "TSP.[CEAID] =  " & ctl.ItemData(varItem) & " & Chr(32) & " Or """"

gives me an error 13 type mismatch

this:

Code:
strWhere = strWhere & "TSP.[CEAID] =  ctl.ItemData(varItem)" & Chr(32) & " Or "

inserts ctl.ItemData(varItem) into the string, as opposed to the underlying value.
 
Fuck a duck.

I did it like this:
Code:
strWhere = strWhere & "TSP.[CEAID] =  " & ctl.ItemData(varItem) & Chr(32) & " Or "

as MSAR suggested and I had tried before. The SQL looked ok. So I put it into a query and tried to run it. At this point Access reminded me that I had the table open. So thats why the code wasn't pulling up anything...

Solved
 
This:

Code:
strWhere = strWhere & "TSP.[CEAID] =  " & ctl.ItemData(varItem) & " & Chr(32) & " Or """"

gives me an error 13 type mismatch

this:

Code:
strWhere = strWhere & "TSP.[CEAID] =  ctl.ItemData(varItem)" & Chr(32) & " Or "

inserts ctl.ItemData(varItem) into the string, as opposed to the underlying value.

You can try converting the number to a string with cStr(), but I still think you do not need the Chr(32) & " Or """"

CORRECTION: Good that you have resolved your issue. I noticed that you had removed the """" in the second example, but I am still pretty sure that you do not need the Chr(32).
 
Last edited:
I don't, I just put those in to make things easier to read.

Ok, it is just that I think that becasue there is only one CHR(34), the string will be interpreted as follows:
strWhere & "TSP.[CEAID] = { Value of ctl.ItemData(varItem) }" Or "
NEVER MIND: I just noticed that it was CHR(32), not CHR(34)

DOH!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom