Reference to be add

SLKDS

Registered User.
Local time
Tomorrow, 01:56
Joined
Jun 24, 2015
Messages
14
Which reference to be added to use Recordset object in Excel VBA. I added "Microsoft DAO 3.6 Object Library" reference but still its not working.

Plz help me on this.

Thank in advance
 
What Error are you getting? Show your DAO Opening code.

Goh
 
I declare recordset as below and tried to set its value:

Dim rst As Recordset

strSQL = "SELECT * FROM Product WHERE OrderNo" _
& " ='" & Order_No & "';"


Set rst = dbs.OpenRecordset(strSQL) ----Error line say Object doesn't support this method
 
where do you declare and define your dbs?
 
Dim dbs As Object


Set dbs = CreateObject("Access.Application")
dbs.OpenCurrentDatabase "..Path of DB.accdb"


Dim rst As Recordset

strSQL = "SELECT * FROM Product WHERE OrderNo" _
& " ='" & Order_No & "';"


Set rst = dbs.OpenRecordset(strSQL) ----Error line say Object doesn't support this method
 
one thing that jumps to mind... Order_no is generaly a number field...
If it is too in your case... try
Code:
strSQL = "SELECT * FROM Product WHERE OrderNo" _
& " = " & Order_No & ""
 
I'll try that and get back to you.

thank you
 

Users who are viewing this thread

Back
Top Bottom