Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers. It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.
Sub test() Dim ParamArr As Integer 'ParamArr = Array(0, 50, 100, 125, 150, 175, 200, 300, 400, 500) 'Dim SqlStr As String 'SqlStr = "SELECT Db1.OP_ID AS ID, [list].PIN, Db1.AMT AS [$Val], [list].LN AS [Last Name], [list].FN AS [First Name], [list].geo AS Loc FROM [list] INNER JOIN Db1 ON [list].wild = Db1.OPERATOR_ID GROUP BY Db1.OP_ID, [list].PIN, Db1.AMT, [list].LN, [list].FN, [list].geo HAVING (((Db1.OP_ID) Is Not Null) And ((Db1.AMT) > ['lower limit'] And (Db1.AMT) <= ['upper limit'])) ORDER BY [list].geo;"" DoCmd.RunSQL SQL_Text, False DoCmd.SetWarnings False 'For i = 1 To ParamArr.Count 'Want to pass i and i+1 each time, untill the end it will be 500 and the second param will be empty as i want 500+ 'Also instead of overwriting the xls file each time append new query as a new worksheet ' This works just exports and I still have to manually enter it. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "MyQuery", "C:test.xls", True 'Next DoCmd.SetWarnings True End Sub
Join the community of 500,000 technology professionals and ask your questions.