G
George Walsh
I have written an event procedure to run when a user clicks a command button
in a form. The button press is supposed to engage the action to make a copy
of a specified table.
The form exposes a list box showing all the table names in the current
database to the user, and it allows the user to specify both the present
name of the table to be copied and the new name of the copied table.
The event procedure in VBA declares two variant variables and performs the
DLookup function to obtain the specified names. This part is tested and
works.
I next want to evoke the DoCmd.CopyObject function which includes the names
of the "DestinationDatabase" and "NewName" as arguments; however, I don't
know how to make the call work unless I actually type the table names
enclosed by quotation marks.
For example: this works ...
DoCmd.CopyObject "ClientSourceData", "ClientSourceData_12-31-1999",
acTable, "ClientSourceData"
Is there any way to get the DoCmd to accept the table names by passing the
table names from the user-selected variables rather than by typing literal
names in quotes in the DoCmd call?
Or, is there another way to accomplish what I am trying to do? I can't find
a solution and would appreciate some suggestions. Thanks.
in a form. The button press is supposed to engage the action to make a copy
of a specified table.
The form exposes a list box showing all the table names in the current
database to the user, and it allows the user to specify both the present
name of the table to be copied and the new name of the copied table.
The event procedure in VBA declares two variant variables and performs the
DLookup function to obtain the specified names. This part is tested and
works.
I next want to evoke the DoCmd.CopyObject function which includes the names
of the "DestinationDatabase" and "NewName" as arguments; however, I don't
know how to make the call work unless I actually type the table names
enclosed by quotation marks.
For example: this works ...
DoCmd.CopyObject "ClientSourceData", "ClientSourceData_12-31-1999",
acTable, "ClientSourceData"
Is there any way to get the DoCmd to accept the table names by passing the
table names from the user-selected variables rather than by typing literal
names in quotes in the DoCmd call?
Or, is there another way to accomplish what I am trying to do? I can't find
a solution and would appreciate some suggestions. Thanks.