Results 1 to 4 of 4
  1. #1
    schulzy175 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Oct 2017
    Posts
    98

    Question Form Running SubQuery Immediately


    It's been a good long while since I've needed to make a form on Access again. I have a simple form - subquery/subform to be queried by a simple date range. When I switch to form view, my query runs immediately without having to enter a date range and choose run - even though I have my query dates setup as
    Code:
    Forms![MyForm]![datefrom]
    and
    Code:
    Forms![MyForm]![dateto]
    . I've done a ton of research, but found nothing relative to my situation. I have old forms that I've gone back to to see what I am doing wrong, but it's setup basically the way my old forms were so I don't know how to keep my subform/subquery from running immediately after choosing form view. Also, upon switching to form view, it doesn't even register that there are no dates to be queried even though the form dates are blank and the query is set to the Form![MyForm]![datefrom/to] redirect.

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Subforms load before the main form.
    The solution is to remove the subform source object and then set it to your subform name after the main forms data is loaded, in the main form load event after all the other stuff you might need to do.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    schulzy175 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Oct 2017
    Posts
    98
    That makes sense. Thank you. I'll see if I can get it. I just don't know how I'm having such a hard time compared to when I first was using forms.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Another option is to not use parameterized query. Apply filter criteria to form Filter property. Review http://allenbrowne.com/ser-62.html
    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: 6
    Last Post: 04-22-2018, 09:12 PM
  2. Replies: 4
    Last Post: 06-11-2015, 12:48 PM
  3. Please help immediately
    By jj1 in forum Access
    Replies: 2
    Last Post: 06-03-2014, 01:47 PM
  4. Forms do not refresh immediately
    By jlgray0127 in forum Forms
    Replies: 1
    Last Post: 03-26-2014, 02:22 PM
  5. Immediately update table with form?
    By Rosier75 in forum Forms
    Replies: 6
    Last Post: 06-08-2012, 09:11 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