Simple problem

S

Sam

I want to run following code

DoCmd.OpenTable "New", acViewPivotTable

But I want the name of the table to be taken from string variable "Name".
How is it done. Must be simple thing, but I can't find answer. Could somebody
help? Thanks!
 
A

Alex Dybenko

so, if your variable name is Name then:

dim Name as string
Name="MyTable"
DoCmd.OpenTable Name, acViewPivotTable
 
K

Klatuu

First thing, don't use the word name. It is a reserved word in Access and it
will be confusing. Try calling it something else. Same thing goes for new.

strSomethingElse = "tblNew"
DoCmd.OpenTable, strSomethingElse, acViewPivotTable
 
Top