vds1
Well-known Member
- Joined
- Oct 5, 2011
- Messages
- 1,200
Hi Gurus -
Thank you for looking into my problem.
Below query works when i execute in MS Access. Its a standard query which i plan to call in Excel using ADO.
When the above query is called using ADO in Excel VBA , i get zero records. Not sure what could be the issue. Please see the code i am using.
Reference used : Microsoft Active X Data Object 2.1 Library
Thank you for looking into my problem.
Below query works when i execute in MS Access. Its a standard query which i plan to call in Excel using ADO.
Code:
[B]select * from qryForwardRecon;[/B]
When the above query is called using ADO in Excel VBA , i get zero records. Not sure what could be the issue. Please see the code i am using.
Code:
DB1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\db.mdb;Persist security info=false;"
'// Get Data from queries
Sheets("RECON_FORWARD").Select
Cells.Clear
StrSQL = "select * from qryForwardRecon;"
Cn.Open DB1
Rs.Open StrSQL, Cn, adOpenKeyset, adLockBatchOptimistic
'// Get field Names
For i = 0 To Rs.Fields.Count - 1
Cells(1, i + 1).Value = Rs.Fields(i).Name
Next
'//Get Data
Range("A2").CopyFromRecordset Rs
Reference used : Microsoft Active X Data Object 2.1 Library
Last edited: