Reference to be add (1 Viewer)

SLKDS

Registered User.
Local time
Today, 06:02
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
 

GohDiamond

"Access- Imagineer that!"
Local time
Yesterday, 20:32
Joined
Nov 1, 2006
Messages
550
What Error are you getting? Show your DAO Opening code.

Goh
 

SLKDS

Registered User.
Local time
Today, 06:02
Joined
Jun 24, 2015
Messages
14
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
 

namliam

The Mailman - AWF VIP
Local time
Today, 02:32
Joined
Aug 11, 2003
Messages
11,695
where do you declare and define your dbs?
 

SLKDS

Registered User.
Local time
Today, 06:02
Joined
Jun 24, 2015
Messages
14
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
 

namliam

The Mailman - AWF VIP
Local time
Today, 02:32
Joined
Aug 11, 2003
Messages
11,695
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 & ""
 

SLKDS

Registered User.
Local time
Today, 06:02
Joined
Jun 24, 2015
Messages
14
I'll try that and get back to you.

thank you
 

Users who are viewing this thread

Top Bottom