query with 2 criteria

schalkse

Registered User.
Local time
Today, 19:57
Joined
Apr 20, 2005
Messages
51
Once again in need of help.

I have a db with articles linked to the articles of a supplier. 1 of our articles can come from more then one supplier. So to make up my order, i choose the supplier and our article number and want to look it up in the db holding the supplier articles.
eg.:
our supplier supl. art.
2001 suplier 1 thx36
2001 supplier 2 895568
2002 suplier 1 TXX895

so the result for supl. 1 with 2001 would be thx36.
When i put this in a query i get an error, to few parameters, expected is 1.
Here is the code:

strSQL = "SELECT tblArtikelKopLev.Artikel, tblArtikelKopLev.Leveranciernummer, tblArtikelKopLev.ArtikelLev, tblArtikelKopLev.OmschrijvingLev FROM tblArtikelKopLev" & _
" WHERE ((tblArtikelKopLev.Artikel = " & strArtikel & ") AND (tblArtikelKopLev.Leveranciernummer = " & strLevnummer & "));"

Anybody any idea?

Thx
 
If the data type of the supplier field is text:

" WHERE ((tblArtikelKopLev.Artikel = " & strArtikel & ") AND (tblArtikelKopLev.Leveranciernummer = '" & strLevnummer & "'));"
 
Thx for the tip.

Have a new problem though. I have an insert query giving me the same problem. Here's the code:

Dim datDate As Date
Dim strJaar As String
Dim strSQL As String
Dim strTransorder As String
Dim strArtikel As String
Dim strArtikelLev As String
Dim lngHoeveelheid As Long
Dim strEenheid As String
Dim datLeverdat As Date
Dim blnBevestig As Boolean
Dim blnGeleverd As Boolean
Dim strOpmerking As String
Dim strBesteltype As String
Dim strLevnummer As String

strSQL = "INSERT INTO tblLevOrder (BestelDat, TransOrder, Artikel, Levcode, ArtikelLev, Hoeveelheid, Eenheid, Leverdat, Bevestigd, Geleverd, Opmerkingen, Jaartal, User, Typeart)" & _
"VALUES ('" & datDate & "', '" & strTransorder & "', '" & strArtikel & "', '" & strLevnummer & "', '" & strArtikelLev & "', " & lngHoeveelheid & ", '" & strEenheid & "', '" & datLeverdat & "', " & blnBevestig & ", " & blnGeleverd & ", '" & strOpmerking & "', '" & strJaar & "', '" & strUser & "', '" & strBesteltype & "')"
MsgBox strSQL

CurrentDb.Execute strSQL, dbFailOnError

In my table:
Besteldat and Leverdat is set as date/time (date)
Hoeveelheid is set as numerical (long integer)
Bevestigd and Geleverd is set yes/no (boolean)

Am sure it has to do something with the quotes.

Any help would be welcome, have been deleting and adding quotes for a few hours and no sollution :(

Thx
 

Users who are viewing this thread

Back
Top Bottom