Results 1 to 3 of 3
  1. #1
    mercapto is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Spain
    Posts
    91

    To get SQL of loaded recordset (not recordsource)


    Hello

    I need to take the SQL of a loaded recordset to use it later.

    I usually take Recordsource, but this time the form refers to a query with input parameters. So it's not only the query name, or the sql of it, it's the WHERE that changes everytime.

    So how can I get this after-input SQL sentence??

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    Suggest not using input parameters in query. I very seldom do.

    I use the WHERE CONDITION of OpenForm/OpenReport, something like:

    DoCmd.OpenForm "form name", , , "ID=" & Me.ID.

    Now can pull strings from not only the RecordSource but also Filter properties of form.
    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
    mercapto is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Spain
    Posts
    91
    Quote Originally Posted by June7 View Post
    Suggest not using input parameters in query. I very seldom do.

    I use the WHERE CONDITION of OpenForm/OpenReport, something like:

    DoCmd.OpenForm "form name", , , "ID=" & Me.ID.

    Now can pull strings from not only the RecordSource but also Filter properties of form.
    Ok, so I understand it's not possible. Thanks for the tip, indeed.

    I finally built the sql "manually" by using the data in the form. Maybe it's better this way because it's a shorter string.

    I will soon change the opening method for the form. When I started my db I didn't know any VBA so I used queries for everything.

    Thanks.

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

Similar Threads

  1. Replies: 3
    Last Post: 11-16-2012, 10:21 AM
  2. How to check if any form is loaded
    By Kivan in forum Programming
    Replies: 3
    Last Post: 09-03-2012, 08:50 AM
  3. Subform empty when main form loaded
    By martyjward in forum Forms
    Replies: 1
    Last Post: 08-15-2011, 04:37 AM
  4. Replies: 1
    Last Post: 05-18-2011, 12:23 PM
  5. Replies: 0
    Last Post: 07-05-2010, 08:00 AM

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