Dim db As DAO.Database, rs As DAO.Recordset, str1Sql As QueryDef, strCrt As String, strDt As String Set db = CurrentDb Set rs = db.OpenRecordset("SELECT distinct fieldname FROM table (or query Probably without parameters) ORDER By fieldname;") '**** fieldname, consider this to be how the records are grouped within the dataset. rs.MoveLast rs.MoveFirst Do While Not rs.EOF strCrt = rs.Fields(0) Set str1Sql = db.CreateQueryDef("" & strCrt, "SELECT table.* FROM table WHERE table.fieldname = '" & strCrt & "';") DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "" & strCrt, "C:\filename " & ".xls", True DoCmd.DeleteObject acQuery, "" & strCrt rs.MoveNext Loop rs.Close Set rs = Nothing Set db = Nothing ********************************