Phoenix_Turn
New Member
- Joined
- May 11, 2011
- Messages
- 37
Hi all,
In access at the moment, I have 3/4 columns. First one: customer name, 2nd: their address, 3rd: phone number.
Now i have this code here at the moment to insert in the excel spreadsheet however it's not fully working. Heres the code:
Dim cnnNames As ADODB.Connection, rstName As ADODB.Recordset 'Dim strNameDatabase As String, strConnectionString As String
Dim rngValue As Range
strNameDatabase = ActiveWorkbook.Path & "\Clients.accdb"'strConnectionString = "Provider=Microsoft.Ace.OLEDB.<wbr>12.0;Data Source=" & strNameDatabase & _
";Persist Security Info=False"
'Set rstName = New ADODB.Recordset
'rstName.Open "Select [Customer] from ClientsTable", strConnectionString, adOpenStatic
Application.ActiveWorkbook.<wbr>Worksheets("Cl").Activate
Application.ActiveWorkbook.<wbr>Worksheets("Cl").Range("<wbr>A1").Select
rngValue = Application.ActiveWorkbook.<wbr>Worksheets("Cl")
Do While Not rstName.EOF
ActiveCell.Offset(1, 0).Value = rstName("Cust")
rstName.MoveNext
Loop
Any idea why its wrong? I want to move it using ADO
In access at the moment, I have 3/4 columns. First one: customer name, 2nd: their address, 3rd: phone number.
Now i have this code here at the moment to insert in the excel spreadsheet however it's not fully working. Heres the code:
Dim cnnNames As ADODB.Connection, rstName As ADODB.Recordset 'Dim strNameDatabase As String, strConnectionString As String
Dim rngValue As Range
strNameDatabase = ActiveWorkbook.Path & "\Clients.accdb"'strConnectionString = "Provider=Microsoft.Ace.OLEDB.<wbr>12.0;Data Source=" & strNameDatabase & _
";Persist Security Info=False"
'Set rstName = New ADODB.Recordset
'rstName.Open "Select [Customer] from ClientsTable", strConnectionString, adOpenStatic
Application.ActiveWorkbook.<wbr>Worksheets("Cl").Activate
Application.ActiveWorkbook.<wbr>Worksheets("Cl").Range("<wbr>A1").Select
rngValue = Application.ActiveWorkbook.<wbr>Worksheets("Cl")
Do While Not rstName.EOF
ActiveCell.Offset(1, 0).Value = rstName("Cust")
rstName.MoveNext
Loop
Any idea why its wrong? I want to move it using ADO
Last edited: