I found the solution and it's quite simple.
I took the sql from the query and added it to the VBA code behind a command button:
Here goes:
DTable = InputBox("Please enter a name for the output table", "?")
mysql = "SELECT table1.Field1 AS F1, table1.Field2 AS F2, table.Field3 AS F3 etc… INTO " & DTable & " FROM table1 GROUP BY table1.Field1;"
DoCmd.RunSQL mysql
laterz,
P