Run Query statement in Excel

L

LSB

I was trying to find a record in the Access database from
my excel sheet. I manage to connect to the database
successfully and come out with the query string. but when
i run the code I can't find the record from the database,
in fact the record is in. In the database, the data type
for each field are:
Field Datatype
Counter Text
Date Date/Time
Volume Number
Unit Price Number

Below is my code:
-----------------------------------------------------------
Set db = OpenDatabase("D:\Profiles\csl096c\My
Documents\Personal\OwnFiles\db1.mdb")
Let strQueryString = "SELECT * FROM Sell " & _
"WHERE Counter LIKE '" & strCounter & _
"' AND Date LIKE '" & strDate & _
"' AND Volume = " & Val(strVolume) & _
" AND [Unit Price] = " & Val(strUnitPrice)

Set rstSell = dbKlse.OpenRecordset(strQueryString)

-----------------------------------------------------------

can somebody please point out to me what possible i did
wrong or i didn't do. Please help. Many Thanks in advance..

Thanks,
SB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top