Results 1 to 4 of 4
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Form Parameters and Pass Through Queries

    I've only just been introduced to Pass Through Queries. I understand that they use the native SQL of the ODBC database they query. I am editing existing queries to make them more flexible. This particular application was set up to have the user open up the query in a SQL window, edit dates and Vendor ID, then save, close and run the query which I thought rather odd. I want to drop some form parameters in there instead such as

    Original: VendorID = '0007060391')



    New: VendorID = Forms!frmNewMonth!cboVendor

    but I keep getting ODBC call failed errors. My solution has been to created a formatted string in VBA and update the query def with it. This is way more complex, but seems like the only option.

    Any suggestions?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You're doing it the way I handle it (use a QueryDef to change the SQL). The ODBC database has no knowledge of the Access form object, so you have to get the value from the form and put it in the SQL you pass to it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    As I figured.

    TYVM,

    Paul

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. If you find a better way, let me know. I made a function I drop into databases that accepts the SQL and query name, which makes it easier. I just pass those to it and it changes the QueryDef.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 10-04-2013, 02:52 PM
  2. Pass parameters
    By BFlat in forum Queries
    Replies: 15
    Last Post: 04-03-2012, 07:27 AM
  3. Pass parameters to a query from a form
    By zipmaster07 in forum Queries
    Replies: 1
    Last Post: 02-21-2012, 02:19 PM
  4. Pass command line parameters
    By lanto3000 in forum Access
    Replies: 2
    Last Post: 03-21-2010, 03:53 PM
  5. Replies: 0
    Last Post: 03-19-2006, 11:52 PM

Tags for this Thread

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