i would suggest the following:
create a query on the fly using the sql then open it.
try puttin this code in yr command button:
Dim strSQL As String
Dim qdf As QueryDef
'Assign your select statement strSQL
'Delete qryTemp if it exists
If DCount("Name", "MSysObjects", "Name = 'qryTemp' AND Type = 5") > 0 Then
DoCmd.DeleteObject acQuery, "qryTemp"
End If
'Create a new query based on strSQL called qryTemp
Set qdf = CurrentDb.CreateQueryDef("qryTemp", strSQL)
DoCmd.OpenQuery "qryTemp", acViewNormal
Set qdf = Nothing
wat this does is, firstly deletes qryTemp if it exists, then creates qryTemp using yr sql statement and opens it.
remember to assign the yr statement the strSQL