Export to Excel + execute multiple query

J

JackpipE

I need to build small Access application.
- I have 1 table and new data will be entered into that table on daily
basis. Some of the data will be duplicate of existing data in that
table.
- I need to export data into excel
- Only new data should be exported
- I need text field where I can enter date and that date will be saved
into another REQUEST_DATE table

My vision of this app is one simple form with "Export" button and
"Date" text field. Once I hit export button All recored will be
exported into Excel and all record IDs will be copied to another
EXPORTED table so I can keep track of what was already exported. Next
time I'll export all records NOT IN exported table. That should take
care of the new data only export.
Question: How can I in Access execute more than one query so I can
Select new records and Update the EXPORTED table at the same time? Can
I also automate export to Excel so once I press the Export button I'll
teg the new records and Export them to Excel spreadsheet.

I'm programming in PHP but not familiar with Access at all. If you
could point me to some good tutorials online where I can get some help
I would appreciate it.

Jack
 
A

Arvin Meyer [MVP]

You do not need a second table to export only certain records. You can
either add a boolean (yes/no) field that will get updated immediately after
the export. Something like:

Query1:

Select * From MyTable Where Export = False;

Then the code for the command button might read:

DoCmd.TransferSpreadsheet acExport, , "Query1","C:\Whatever.xls"
DoEvents
CurrentDb.Execute "UPDATE MyTable SET Export = True;

Since all the records will have now been exported, setting everything to
True makes it an easy query.

You can also set a date field in the table to default to:

=Date()

so that your export will only be those records done that date.:

Query1:

Select * From MyTable Where ExportDate = Date();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top