Hi,
I would like to run a make-table query in VBA which will be attached to a button in a form. The form will also contain two text boxes; one where the user types in the original table to apply the query to (table1) and the new name of the table created (table2). My question is, at the moment my SQL string refers to a static table (table) and I would like it to refer to table1. Below is the macro so far..
Private Sub Button1_Click()
** Dim strSQL As String
***strSQL = "SELECT
![Field1] AS field1,
![field2] AS field2" _
** & " INTO " & Table2.Value _
** & " FROM " & Table1.Value _
** & " GROUP BY
![field3];" _
** DoCmd.SetWarnings False
** DoCmd.RunSQL strSQL
** DoCmd.SetWarnings True
End Sub
Any help would be much appreciated.
Thanks
I would like to run a make-table query in VBA which will be attached to a button in a form. The form will also contain two text boxes; one where the user types in the original table to apply the query to (table1) and the new name of the table created (table2). My question is, at the moment my SQL string refers to a static table (table) and I would like it to refer to table1. Below is the macro so far..
Private Sub Button1_Click()
** Dim strSQL As String
***strSQL = "SELECT
** & " INTO " & Table2.Value _
** & " FROM " & Table1.Value _
** & " GROUP BY
** DoCmd.SetWarnings False
** DoCmd.RunSQL strSQL
** DoCmd.SetWarnings True
End Sub
Any help would be much appreciated.
Thanks