Results 1 to 11 of 11
  1. #1
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317

    "Form.Requery" ignoring new parameters


    In several of my Access files, I have an unbound form into which the user enters a pair of date parameters ("ParametersForm"). I also have a bound form in which query results are displayed in datasheet view ("ResultsForm"). The user clicks on a button in ParametersForm to open ResultsForm, or, if it's aleady open, requery it. The dates entered in ParametersForm are used as criteria in at least one of the queries underlying ResultsForm.

    This works fine where all the queries are simple SELECT queries, but I've come across a problem where any of them is a crosstab query: if ResultsForm is already open and the user enters a new pair of dates in ParametersForm, the new dates are ignored when ResultsForm is requeried. So what do I need to use other than "Forms!ResultsForm.Requery"? Note that the parameters are declared within the crosstab query.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    Well, you could close/reopen the form as a workaround. Is there perhaps code running when the results form opens to handle dynamic crosstab fields?
    Last edited by pbaldy; 09-10-2018 at 10:47 AM. Reason: fix autocorrect goof
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    Thanks for your reply. Closing and reopening is the only possibility I've thought of. I've read that you can even disguise the break with "Application.Echo False", although our network is so rubbish that I'm not sure this will make much difference.

    Can you please give me a bit more on your question ("
    Is there perhaps code running when the results form opens to handle dynamic crosstab fields?")? ResultsForm opens with "DoCmd.OpenForm". Nothing else is going on.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    Does the crosstab return the same fields all the time? If not, there may be code in the results form that would need to run (a common way of handling variable fields being returned).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    Yes, the same fields are returned all the time.

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    Can you attach the db here? I would expect the requery to work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    Thanks, I'll attach a copy with some dummy data, when I'm back at work on Monday.

  8. #8
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    OK, I've attached a sample. What I called 'ParametersForm' in my original post is called 'Parameters', and what I called 'ResultsForm' is called 'Final'.

    Try this:

    1. Open Parameters.
    2. Enter 01/08/2018 and today's date in the two date fields.
    3. Select the option 'Taxi'.
    4. Click on 'View in Access'.
    That should open Final.

    5. Select the option 'Other'.
    6. Click on 'View in Access' again.
    That should display different data, but it doesn't - although it does change the caption!
    Attached Files Attached Files

  9. #9
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    Curious, it certainly isn't acting as I would expect. Perhaps somebody else will chime in with a better fix, but in the meantime I'd go with the close/open method you have commented out. Is that slow on the actual db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    I'm glad I'm not the only one who's puzzled! The workaround is slowish, but I'll get away with it.

    I'm going to leave the thread open in case someone else has the answer. Thanks for your help.

  11. #11
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    No problem. Perhaps I'm having brain cramps, so I hope somebody has a better solution.
    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. Suppress "Requery" and/or "Repaint" when running function
    By GraeagleBill in forum Programming
    Replies: 3
    Last Post: 12-08-2017, 12:04 AM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 1
    Last Post: 07-10-2015, 06:33 AM
  4. Replies: 7
    Last Post: 12-21-2014, 08:21 PM
  5. Replies: 2
    Last Post: 08-31-2006, 12:19 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