Select String S’abonner

0
Avatar
Legacy Poster

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?

2 commentaires

0
Avatar
Shotaro Ito
Modérateur
Actions pour les commentaires Permalien

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
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Thank you Shotaro!

That helped me ;)

Vous devez vous connecter pour laisser un commentaire.