Select String
Hello
I have a select string in my VBscript, where I want to get data specified by some values in my label.
This works great:
rs.open "SELECT * FROM [Ark1$] WHERE [Modelnr:] = '" & Format.NamedSubStrings("subModel").Value & "' AND [Farve:] = '" & Format.NamedSubStrings("subFarve").Value & "' "
But when I add another WHERE statement, I get this error: Datatypes mismatch
The only thing I see that can be a problem, is the value in the text object and in my excel database is a number.
Do I have to specify this somewhere?
I have a select string in my VBscript, where I want to get data specified by some values in my label.
This works great:
rs.open "SELECT * FROM [Ark1$] WHERE [Modelnr:] = '" & Format.NamedSubStrings("subModel").Value & "' AND [Farve:] = '" & Format.NamedSubStrings("subFarve").Value & "' "
But when I add another WHERE statement, I get this error: Datatypes mismatch
The only thing I see that can be a problem, is the value in the text object and in my excel database is a number.
Do I have to specify this somewhere?
0
-
Shotaro Ito
★ BarTender Hero ★
Hi Dinsen,
you need to match data type. Either
you take single quote out from WHERE condition to treat condition as numeric
[sql]"... WHERE [Modelnr:] = " & Format.NamedSubStrings("CONDITION1").Value & " AND [Farve:] = " & Format.NamedSubStrings("CONDITION2").Value [/sql]
or insert single quote (') at the beginning of numeric excel cells, to treat excel cell data as string.
hope that helps!0 -
Legacy Poster
★ BarTender Hero ★
Thank you Shotaro!
That helped me0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
2 commentaires