I'm quite new to vba, and was looking for some assistance in retrieving values from an array. I was planning on making an array to store table names, then run an update query which will loop for all the tables in the array. My current code to test the array is:
Sub ImportSchemaTable()
Dim db As DAO.Database
Dim Arr(10) As String
Arr(0) = "PS0006_DELTA2"
Set db = CurrentDb()
db.Execute _
"INSERT INTO Arr(0) SELECT * FROM [Text;FMT=Fixedlength;HDR=Yes;DATABASE=C:\database\;].[PS0006#txt];", _
dbFailOnError
db.TableDefs.Refresh
End Sub
"PS0006_DELTA2" is the name of the table, but I can't get the SQL statement to retrieve this from the array. The update query runs fine if i input the table name manually, but I will not be able to loop it this way. Can anyone tell me what I am doing wrong?
Thanks
Chris
Sub ImportSchemaTable()
Dim db As DAO.Database
Dim Arr(10) As String
Arr(0) = "PS0006_DELTA2"
Set db = CurrentDb()
db.Execute _
"INSERT INTO Arr(0) SELECT * FROM [Text;FMT=Fixedlength;HDR=Yes;DATABASE=C:\database\;].[PS0006#txt];", _
dbFailOnError
db.TableDefs.Refresh
End Sub
"PS0006_DELTA2" is the name of the table, but I can't get the SQL statement to retrieve this from the array. The update query runs fine if i input the table name manually, but I will not be able to loop it this way. Can anyone tell me what I am doing wrong?
Thanks
Chris