Make a Table Name from a Parameter

Carly

Registered User.
Local time
Today, 21:19
Joined
Apr 16, 2003
Messages
86
I have got the code to run the same query many times by passing a parameter through as follows:

DoCmd.DeleteObject acTable, "tbl BranchParameter"
Set cmdRunQuery = New ADODB.Command
With cmdRunQuery
.ActiveConnection = CodeProject.Connection
.Properties("Jet OLEDB:Stored Query") = True
.CommandText = "BranchParameter"
.Parameters("[Branch]") = 1000
.Execute
End With
With DoCmd
.RunSQL ("ALTER TABLE [tbl BranchParameter] ADD PRIMARY KEY ([SalesOffice])")
.OutputTo acQuery, "Qry 1i Branch Sector Report", ".xls", "\\sysdevweb\bw\SIC Codes\Work Files\Food Industry\Group.xls", False
End With

But is there anyway I can use the parameter 1000 as the table name in a Make a table query?
i.e. Instead of using the OutputTo command I want use the OpenQuery Command to Make a table called 1000.
 

Users who are viewing this thread

Back
Top Bottom