S
Sajit
I have been through the posts related to this,
However, I have a slightly different problem with linking an Excel table to
Access.
I am able to link the Excel table using the tool bar > get external data >
wizard. I don't get the error 3170.
However I have a line of code: "dbsTemp.TableDefs.Append tdfLinked"
within the below, which gives the 3170 error.
Sub test()
Dim dbsTemp As Database
Dim tdfLinked As TableDef
Dim rstLinked As Recordset
Dim intTemp As Integer
Dim strTable As String
Dim strconnect As String
Set dbsTemp = CurrentDb()
strTable = "ExcelTable"
Set tdfLinked = dbsTemp.CreateTableDef(strTable)
new1 = InputBox("Enter a data sheet name to create")
new2 = new1 & "_Data"
new5 = "Data for " & new1 & " Valves"
strconnect = "Excel 2003; Database = O:\9210L\Works\A353\MATERIALS\SP\" &
new5 & ".xls"
tdfLinked.Connect = strconnect
SourceTable = "Data1"
tdfLinked.SourceTableName = SourceTable
dbsTemp.TableDefs.Append tdfLinked
new3 = new1 & "_Note_tbl"
DoCmd.CopyObject , new2, acTable, "Ball_Note_tbl"
new4 = new1 & "_Notes"
DoCmd.CopyObject , new2, acTable, "Ball_Notes"
End Sub
Will I have to do the methods under the links in there as well?
Sajit
However, I have a slightly different problem with linking an Excel table to
Access.
I am able to link the Excel table using the tool bar > get external data >
wizard. I don't get the error 3170.
However I have a line of code: "dbsTemp.TableDefs.Append tdfLinked"
within the below, which gives the 3170 error.
Sub test()
Dim dbsTemp As Database
Dim tdfLinked As TableDef
Dim rstLinked As Recordset
Dim intTemp As Integer
Dim strTable As String
Dim strconnect As String
Set dbsTemp = CurrentDb()
strTable = "ExcelTable"
Set tdfLinked = dbsTemp.CreateTableDef(strTable)
new1 = InputBox("Enter a data sheet name to create")
new2 = new1 & "_Data"
new5 = "Data for " & new1 & " Valves"
strconnect = "Excel 2003; Database = O:\9210L\Works\A353\MATERIALS\SP\" &
new5 & ".xls"
tdfLinked.Connect = strconnect
SourceTable = "Data1"
tdfLinked.SourceTableName = SourceTable
dbsTemp.TableDefs.Append tdfLinked
new3 = new1 & "_Note_tbl"
DoCmd.CopyObject , new2, acTable, "Ball_Note_tbl"
new4 = new1 & "_Notes"
DoCmd.CopyObject , new2, acTable, "Ball_Notes"
End Sub
Will I have to do the methods under the links in there as well?
Sajit