ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Retrieve from Acces (https://www.excelbanter.com/excel-programming/365507-retrieve-acces.html)

WayneR

Retrieve from Acces
 
Hi,

Is there a way to retrieve infomration from a MS Access database and load a
spreadsheet?

--
WayneR

Ron de Bruin

Retrieve from Acces
 
Hi WayneR

Try the examples on this page
http://www.rondebruin.nl/accessexcel.htm

--
Regards Ron De Bruin
http://www.rondebruin.nl



"WayneR" wrote in message ...
Hi,

Is there a way to retrieve infomration from a MS Access database and load a
spreadsheet?

--
WayneR




CLamar

Retrieve from Acces
 
Yes it is that I use is: Let me know how it works. Make sure u modify it to
accept you sheet names and path names

Dim DbFullName As String
Dim Cnct As String, Src As String
Dim Connection As ADODB.Connection
Dim Recordset As ADODB.Recordset
Dim Col As Integer

Cells.Clear

'Connects to the MS Access Database
Set Connection = New ADODB.Connection
Cnct = "Driver={Microsoft Access Driver
(*.mdb)};Dbq=C:\Pathname;Uid=Admin;Pwd=;"
Connection.Open ConnectionString:=Cnct

'Opens the recordset
Set Recordset = New ADODB.Recordset

With Recordset

'Copies the field names from the database into an Excel worksheet
For Col = 0 To Recordset.Fields.count - 1
Sheets("List").Range("A1").Offset(0, Col).Value =
Recordset.Fields(Col).Name
Next

'Copies the data inside the recordset into a worksheet
Sheets("List").Range("A1").Offset(1, 0).CopyFromRecordset
Recordset

End With
Set Recordset = Nothing
Connection.Close
Set Connection = Nothing
End Sub
"WayneR" wrote:

Hi,

Is there a way to retrieve infomration from a MS Access database and load a
spreadsheet?

--
WayneR


WayneR

Retrieve from Acces
 
Great examples Ron,

Do you possibly have anything similar for updating Access DB from Excel? --

--
WayneR


"Ron de Bruin" wrote:

Hi WayneR

Try the examples on this page
http://www.rondebruin.nl/accessexcel.htm

--
Regards Ron De Bruin
http://www.rondebruin.nl



"WayneR" wrote in message ...
Hi,

Is there a way to retrieve infomration from a MS Access database and load a
spreadsheet?

--
WayneR





Ron de Bruin

Retrieve from Acces
 
Working on it Wayne
Not much time for it on this moment

You can also check out this site for example code
http://www.erlandsendata.no/english/...php?t=envbadac


--
Regards Ron de Bruin
http://www.rondebruin.nl



"WayneR" wrote in message ...
Great examples Ron,

Do you possibly have anything similar for updating Access DB from Excel? --

--
WayneR


"Ron de Bruin" wrote:

Hi WayneR

Try the examples on this page
http://www.rondebruin.nl/accessexcel.htm

--
Regards Ron De Bruin
http://www.rondebruin.nl



"WayneR" wrote in message ...
Hi,

Is there a way to retrieve infomration from a MS Access database and load a
spreadsheet?

--
WayneR








All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com