I am trying to read data from a database table on CD. I am opening another
database on my hard drive, and then trying to 'attach' the table on CD to
the database on my hard drive. I get an invalid argument message using the
code below.
Private Sub Form_Load()
Dim cdbName As String, dBS As String
Dim myStr, lakeStr, netStr, dateStr As String, lakeRS, netRS, dateRS As
Recordset
Dim origDB As Database
Dim NewTdf As TableDef 'table def for attached table
cdbName = "E:\DATA\READ_CD\FISHDATA.MDB" 'This is the path for the data
on CD
myStr = App.Path & "\FishData.MDB" 'define database path for data on
harddrive
Set origDB = OpenDatabase(myStr) ''define species code list database
Set NewTdf = origDB.CreateTableDef("cdPrim")
NewTdf.SourceTableName = "Primary"
NewTdf.Connect = ";DATABASE = '" & cdbName & "';"
origDB.TableDefs.Append NewTdf 'append or attach external table to current
database THIS IS WHERE IT BUGS DOWN
End Sub