mbentley
Registered User.
- Local time
- Today, 11:31
- Joined
- Feb 1, 2002
- Messages
- 138
I am trying to select records from a table and export only the selected records to Excel.
There may be a better way to do this, but the only way I could figure out was to create a recordset from the original table, create a new table of just the selected records, export the new table as an Excel spreadsheet, and then delete the new table.
I have it all set up nicely, except for one small problem. Although the new table is getting the data I want, it is not appearing in the exported spreadsheet. Through extensive troubleshooting, I've discovered that the problem is that the data does not appear in the new table until after the code stops executing. (And yes, I have run the rs.Update command...the recordset won't close unless I do this.)
I'm sure there's some sort of recordset or database refresh or update command, but I can't find it. Anyone know what I need to do?
Funny thing is that the spreadsheet exports properly when I step through the code, but not if I let it run.
There may be a better way to do this, but the only way I could figure out was to create a recordset from the original table, create a new table of just the selected records, export the new table as an Excel spreadsheet, and then delete the new table.
I have it all set up nicely, except for one small problem. Although the new table is getting the data I want, it is not appearing in the exported spreadsheet. Through extensive troubleshooting, I've discovered that the problem is that the data does not appear in the new table until after the code stops executing. (And yes, I have run the rs.Update command...the recordset won't close unless I do this.)
I'm sure there's some sort of recordset or database refresh or update command, but I can't find it. Anyone know what I need to do?
Funny thing is that the spreadsheet exports properly when I step through the code, but not if I let it run.
Last edited: