Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your code merely creates a connection to a database, it doesn't open any tables.
Replace your line: ' open a recordset With these lines: Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset With rs .Source = "SELECT * FROM " & ans .ActiveConnection = cn .Open End With ' Do something with recordset rs.Close cn.Close -- "George" wrote in message ... Hi there, I am using this code to connect to the access database but its not opening the tables I want to open: Sub Auto_Open() Dim cn As ADODB.Connection ans = InputBox("What Table you want to analyze?") ' connect to the Access database Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=C:\FolderName\DataBaseName.mdb;" ' open a recordset End Sub Pls if you have any information that I can use to fix this problem let me know |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Connecting Excel sheets to Access Tables??? | Excel Discussion (Misc queries) | |||
Excel in macro and connecting to a network drive question | Excel Discussion (Misc queries) | |||
Call an Access macro from an Excel macro | Excel Discussion (Misc queries) | |||
Macro Error When Connecting to Hidden Sheet | Excel Discussion (Misc queries) | |||
Launch Macro in Access via Macro running in Excel??? | Excel Programming |