Several people have asked how loops can be used in Access and Excel.

The following is code inside the click event of an access button.
It dynamically creates SQL code for a recordset, creates a blank Excel workbook, line 103 to 110 creates a hard coded title. At the next row, we harvest data from the database record set and places each row into the Excel worksheet. Some simple math is performed each row a field at a time.
In this case a Buy vs Sell just determineis if the data is multiplied by negative one.
After the data is created in Excel,

Please Login or Register  to view this content.