Private Sub TimeToCompletionI() Dim db As Database Set db = CurrentDb Dim qry1 As QueryDef Dim sSQL1 As String On Error Resume Next db.QueryDefs.Delete "temp1" On Error GoTo 0 sSQL1 = "SELECT * from Employees" Set qry1 = db.CreateQueryDef("temp1", sSQL1) DoCmd.OpenQuery qry1.Name End Sub