S
Steven
Can I create a query in the query tab and use a variable
for the name of the table? I can have 30 tables and do
not want to create a query for each one. I want one query
and pass variables.
Example:
Dim CurrentBatch, CurrentBatchImport as String
CurrentBatch = "Batch05"
CurrentBatchImport = "Batch05Import"
I want to use the CurrentBatch and CurrentBatchImport
variables for my tables in the SQL View on the Query
Design. In this example I would get
normally with actual table names in the SQL View on the
Query Design:
INSERT INTO Batch05
SELECT Batch05Import.*
FROM Batch05Import
WITH OWNERACCESS OPTION;
.....How can I use CurrentBatch in place of the Batch05 and
CurrentBatchImport in place of the Batch05Import in this
SQL VIEW so I can pass the name of different files...I
cannot get it to work like a normal string or
concatenation in the SQL View in the Query Tab Design.
Can this be done? I have used in the past
DoCmd.RunSQL "sqlString" where the "sqlString" was the
correct INSERT string giving you total control over the
table names by using variables.
But I cannot use the DoCmd.RunSQL in this case. It has to
be done with a Query created in the query tab design so I
can set Permissions as Owners in the query.
Thank you for your help.
Steven.
for the name of the table? I can have 30 tables and do
not want to create a query for each one. I want one query
and pass variables.
Example:
Dim CurrentBatch, CurrentBatchImport as String
CurrentBatch = "Batch05"
CurrentBatchImport = "Batch05Import"
I want to use the CurrentBatch and CurrentBatchImport
variables for my tables in the SQL View on the Query
Design. In this example I would get
normally with actual table names in the SQL View on the
Query Design:
INSERT INTO Batch05
SELECT Batch05Import.*
FROM Batch05Import
WITH OWNERACCESS OPTION;
.....How can I use CurrentBatch in place of the Batch05 and
CurrentBatchImport in place of the Batch05Import in this
SQL VIEW so I can pass the name of different files...I
cannot get it to work like a normal string or
concatenation in the SQL View in the Query Tab Design.
Can this be done? I have used in the past
DoCmd.RunSQL "sqlString" where the "sqlString" was the
correct INSERT string giving you total control over the
table names by using variables.
But I cannot use the DoCmd.RunSQL in this case. It has to
be done with a Query created in the query tab design so I
can set Permissions as Owners in the query.
Thank you for your help.
Steven.