![]() |
|
#1
|
|||
|
|||
|
Hi,
Can anyone help me with this? I found this code but can't seem to get it to work. Access file = PE_CG_list Table = PE-GC-list Column = PEs I have the data source ending in .accdb because that's the path to the file although the original code said to put .mdb. When I put .mdb it says it can't find the file but with .accdb it says it doesn't know the database type. I have references set to both ADO and Access. Code:
Sub AutoOpen()
On Error GoTo Document_Open_Err
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=U:\TPCentral_Too\PE_GC_list.accdb"
.Open "SELECT [PEs] FROM PE-GC-list ORDER BY [PEs];", _
cnn, adOpenStatic
rst.MoveFirst
With ThisDocument.ComboBox1
.Clear
Do
.Add rst![PEs]
rst.MoveNext
Loop Until rst.EOF
End With
Document_Open_Exit:
On Error Resume Next
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Exit Sub
Document_Open_Err:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical, "Error!"
Resume Document_Open_Exit
End Sub
|
|
#2
|
|||
|
|||
|
Can anyone help me with this, please?
Pretty please?
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MM to Access 97 lost its link - broken by Windows Update? | LesD | Mail Merge | 0 | 11-23-2010 07:13 AM |
| Excel 07-Access 03 Data Link Issue | ddw23 | Excel | 0 | 08-20-2010 09:05 AM |
Combobox manipulation
|
vsempoux | Word VBA | 3 | 10-31-2009 08:58 AM |
| Excel to lookup Access Database | PeterP | Excel | 1 | 06-11-2009 12:33 PM |
Access database engine with Streets and Trips 2009
|
dreemsnake | Misc | 3 | 05-26-2009 10:25 AM |