Re: Cross Reference Excel Sheet To ODBC
I didn't follow at first, but some Googling has gotten me a bit further. It seems like I'm connecting, but I can't seem to access either table in there. I get an error saying the object doesn't exist referring to the table name. I used the same names that the tables are named in Access when I usually access them.
I've got something like this. I know it's not fully correct yet:
Public Sub accessDB() Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim data As Variant
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
cnn.Open "db", "user", "pass" ' I'll be using the appropriate ones
rst.ActiveConnection = cnn
rst.CursorLocation = adUseServer
rst.Source = "SELECT * FROM Table_Name"
rst.Open ' ERROR here
Cells(1, 1).CopyFromRecordset rst
rst.Close
Set rst = Nothing
Set cnn = Nothing
End Sub
Display More
Any pointers? Rookie mistakes? Thanks.