Results 1 to 4 of 4
  1. #1
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215

    Generate Value for Text Box Based on Forms Underlying Recordsource (Query)


    Hi,

    I have 3 forms: Main -> Subform1 -> Subform2 (a subform of 1).

    Subform2's Recordsource is a Query. On Subform2, I have unbound combo boxes. The query criteria seeks the values of those combo boxes using this

    [forms]![Main]![Subform1].[Form]![Subform2].[Form]![Control]

    I have a Command Button on Subform2 that refreshes everything (sendkeys F9) and then makes a TextBox visible. This TextBox should show some value given the underlying query. However, the only value that I get back is usually always the first value in that query (sometimes nothing).

    Can you set a forms underlying RecordSource to a dynamically change query?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Yes. This is one technique to dynamically filter a form's RecordSource. However, I have never used dynamic parameterized queries. I've never needed to filter a subform beyond what is accomplished by the Master/Child Links properties.
    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
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    How do you refresh that forms recordsource based on those parameters? I dont think sendkeys F9 is working.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Maybe with VBA:

    [forms]![Main]![Subform1].[Form]![Subform2].Requery
    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: 4
    Last Post: 11-25-2014, 11:23 AM
  2. Replies: 8
    Last Post: 06-04-2014, 10:41 AM
  3. Replies: 6
    Last Post: 03-19-2014, 03:53 PM
  4. Forms to generate Purchase Orders(PO)
    By 555Rage in forum Access
    Replies: 21
    Last Post: 09-13-2012, 05:00 AM
  5. Replies: 2
    Last Post: 10-16-2009, 02:47 PM

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