Forum Discussion

GeorgieAnne's avatar
GeorgieAnne
Iron Contributor
Mar 26, 2025

How to make a Saved Export

Hello All,

My very first post in the MS-Access lounge.

I need to automate these steps:

  1. Press F-11 to get to the All Access Objects pane.
  2. Select a Table named Priority
  3. The Priority table has a Date field and I click on the arrow at the right edge of the field name.
  4. I move the mouse to the date Filter option in the dropdown menu.
  5. I select Today.
  6. Now the table has all priority with today's date in the date field.
  7. I click on the left most corner to select all the table rows.
  8. I copy the selection
  9. I paste into MS-Excel.

Is there a way to save all these steps into a Saved Export so that it can be made easier and standardized.

 

If it can be done without the use of VBA so much the better.

Still using Access 2007 - 2016 file format

Thanks in advance.

 

Gigi...

 

  • This can be done with a query (e.g. "PriorityToday") that has a where clause for the current date. Change Datefield to internal date name in table Priority:
    SELECT * FROM Priority WHERE [Datefield] = Date();

    Export "PriorityToday" as an Excel workbook (right-click menu). On the last page of the export wizard, name a new Saved Export. If you wish, create an Outlook Task.
    Done.
     
    By the way, allowing MS Access but not VBA does not make sense to me.

  • XPS35's avatar
    XPS35
    Iron Contributor

    Why no VBA? You can do that in VBA with a single line of code. Something like 

    DoCmd.TransferSpreadsheet acExport,, "SELECT *FROM Priority WHERE Your Date = Date()", "YourExcel.xlsx"

    • GeorgieAnne's avatar
      GeorgieAnne
      Iron Contributor

      Thank You XPS35,

      The reason for no VBA is because this is a work assignment and to go the VBA way, will require approvalS, notice the uppercase S, which would be probably approved in the year 2065! :-) At times I do dislike my job, but most of the times I love it.   

    • arnel_gp's avatar
      arnel_gp
      Steel Contributor

      you can't use an SQL string in any Transfer() functions.

      create a Query and use the Query in your Transfer.

      example:

      SELECT * FROM Priority Where YourDateField = Date;

      save the query (say Query1).

      now use Query1 to your TransferSpreadsheet.

      (this will save to Priority.xlsx in Documents folder)

      Docmd.TransferSpreadsheet acExport,acSpreadsheetTypeExcel12Xml,"Query1",environ$("userprofile") & "\Documents\Priority.xlsx"

       

      • GeorgieAnne's avatar
        GeorgieAnne
        Iron Contributor

        Thank You arnel_gp 

        Could you tell me if I could run this from MS-Excel directly say as if I was doing a Get External Data.

        From MS-Excel Data Ribbon, Get Data, From Database, From Microsoft Access Database

        Will any thing change if the database has a password?

        Thanks,

         

        GiGi

         

Resources