Click here to Skip to main content
15,886,795 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I hope i'm not on the wrong place, been a while since i logged in.

Hi everyone, i am working on a simple VBA project. i have an MS access database and i want to view its content on excel. i was able to connect to the database and fetch the content of the table.

to make sure that i am getting the table's content, i was able to use message box to show the data that i needed and i see it correctly fetches them

now my problem is, how do i put the data in an excel cell?

below is the code to fetch the data, assuming that connection to DB is OK.



'Set the ADO Recordset object:
Set adoRecSet = New ADODB.Recordset
'Opening the table named Provider:
strTable = "providertbl"

adoRecSet.Open Source:=strTable, ActiveConnection:=connDB, CursorType:=adOpenStatic, LockType:=adLockPessimistic

For i = 0 To adoRecSet.Fields.Count - 1
'get field / column name:
MsgBox adoRecSet.Fields(i).Name
adoRecSet.MoveFirst

Do While Not adoRecSet.EOF
'get record value:
MsgBox adoRecSet.Fields(i).Value
adoRecSet.MoveNext
Loop
Next i


can someone give an idea how to do put the data in a excel cell? thanks a lot.
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900