I need to duplicate a table in the same database when a button is clicked. How do I code that? Also, is it possible to use the same default name so the query won't have to ask you for the table name everytime?
You could do this in a the click event of the button.
Dim strSQL As String
'Assume you want to copy the Depts table to DeptsCopy
'Create the SQL statement
strSQL="SELECT Depts.* INTO DeptsCopy FROM Depts;"
'Turn off warning messages
DoCmd.SetWarnings False
'Copy the table by executing the SQL statement
DoCmd.RunSQL (strSQL)
'Turn on warning messages
DoCmd.SetWarnings True
Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.