K
kami
I have a table that I am updating it via a data entry form, but prior to
updating the table in the form I want to make a backup copy of the table.
When the form opens I want Access to ask for a new table name and copy the
content of current table into the new table as given by the input box prompt.
I am using input box but cannot use the users input for the new table name
since runsql doesn’t accept string variable (StrName) as the new table name
during insert into.
Private Sub Form_Open(Cancel As Integer)
Dim StrName As String
DoCmd.OpenTable table1, acViewPreview ‘Open current tableâ€
StrName = InputBox("Enter new table Name:")
docmd.RunSQL (SELECT Table1.name, Table1.[last name] INTO StrName FROM
Table1) ‘Name the new table using the input box
DoCmd.Close acDefault, table1, acSaveNo, ‘close current table prior to editing
End Sub
Can anyone help and suggest a solution. Thanks
updating the table in the form I want to make a backup copy of the table.
When the form opens I want Access to ask for a new table name and copy the
content of current table into the new table as given by the input box prompt.
I am using input box but cannot use the users input for the new table name
since runsql doesn’t accept string variable (StrName) as the new table name
during insert into.
Private Sub Form_Open(Cancel As Integer)
Dim StrName As String
DoCmd.OpenTable table1, acViewPreview ‘Open current tableâ€
StrName = InputBox("Enter new table Name:")
docmd.RunSQL (SELECT Table1.name, Table1.[last name] INTO StrName FROM
Table1) ‘Name the new table using the input box
DoCmd.Close acDefault, table1, acSaveNo, ‘close current table prior to editing
End Sub
Can anyone help and suggest a solution. Thanks