Results 1 to 4 of 4
  1. #1
    Datech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    40

    Specify query parameter for saved query with Transfer to Spreadsheet

    From MSDN:


    In Access, you can't use an SQL statement to specify data to export when you are using the TransferSpreadsheet action. Instead of using an SQL statement, you must first create a query and then specify the name of the query in the Table Name argument.
    Because of that, is there any way to have my users specify the values in a WHERE condition within a saved query? I have a combo box of all my project managers, and when one is selected it filters the results of a table to where tblResourceAllocation.ProjectManager = form.cboProjectManager.value. The displayed values are unions with a couple of different tables, but the export I want is actually just the info from one table where the ProjectManager field is the same as the combo box selection.

    Is there any way to save a Select query that selects the results from that one table (tblGRFM) with a WHERE tblGRFM.ProjectManager LIKE form.cboProjectManager? I could then use that saved query with that parameter as the named query in the TransferSpreadsheet call. Any alternative solutions?
    Last edited by Datech; 08-16-2012 at 10:57 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You have the right idea, no alternative needed. Input can be a popup prompt (I never use) or can be reference to control on form. The sql built by the query designer could look like:

    SELECT * FROM tblGRFM WHERE ProjectManager = Forms!formname!cboProjectManager;

    The export will be filtered recordset.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Datech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    40
    That worked perfectly June. I figured Access wouldn't like that, so I didn't even try.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Seldom hurts to try. Glad it worked for you.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-15-2012, 07:41 PM
  2. Transfer Spreadsheet
    By mulefeathers in forum Import/Export Data
    Replies: 1
    Last Post: 05-02-2012, 12:52 PM
  3. Button Command to Transfer Spreadsheet
    By diane802 in forum Programming
    Replies: 3
    Last Post: 02-10-2010, 09:26 AM
  4. Transfer SpreadSheet Command and Rename
    By fintan06 in forum Import/Export Data
    Replies: 2
    Last Post: 10-15-2009, 08:00 AM
  5. File path name using Transfer spreadsheet
    By JohnN in forum Import/Export Data
    Replies: 0
    Last Post: 11-14-2005, 06:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums