Hi There,
I have some data in an access database that i am importing into excel with the following code. My problem is that there are more than 65536 records. How do i get excel to continue importing the data onto a new worksheet ?
Sub GetEnquiryTable()
Dim Db As Database
Dim Rs As Recordset
Dim Ws As Object
Dim i As Integer
Dim Path As String
Set Ws = Sheets("Sheet1"
Path = "C:\Database Files\Enquiry Table.mdb"
Ws.Range("A1"
.CurrentRegion.ClearContents
Set Db = Workspaces(0).OpenDatabase(Path, ReadOnly:=True)
Set Rs = Db.OpenRecordset("Enquiry Table"
For i = 0 To Rs.Fields.Count - 1
Ws.Cells(1, i + 1).Value = Rs.Fields(i).Name
Next i
Ws.Range(Ws.Cells(1, 1), Ws.Cells(1, Rs.Fields.Count)).Font.Bold = True
Ws.Range("A2"
.CopyFromRecordset Rs
Ws.Range("A1"
.CurrentRegion.Columns.AutoFit
Rs.Close
Db.Close
End Sub
Any help would be appreciated.
Rgds, John
I have some data in an access database that i am importing into excel with the following code. My problem is that there are more than 65536 records. How do i get excel to continue importing the data onto a new worksheet ?
Sub GetEnquiryTable()
Dim Db As Database
Dim Rs As Recordset
Dim Ws As Object
Dim i As Integer
Dim Path As String
Set Ws = Sheets("Sheet1"
Path = "C:\Database Files\Enquiry Table.mdb"
Ws.Range("A1"
Set Db = Workspaces(0).OpenDatabase(Path, ReadOnly:=True)
Set Rs = Db.OpenRecordset("Enquiry Table"
For i = 0 To Rs.Fields.Count - 1
Ws.Cells(1, i + 1).Value = Rs.Fields(i).Name
Next i
Ws.Range(Ws.Cells(1, 1), Ws.Cells(1, Rs.Fields.Count)).Font.Bold = True
Ws.Range("A2"
Ws.Range("A1"
Rs.Close
Db.Close
End Sub
Any help would be appreciated.
Rgds, John