Results 1 to 5 of 5
  1. #1
    amcintosh is offline Novice
    Windows 10 Office 365
    Join Date
    Dec 2020
    Posts
    6

    Query ask for Parameter on DoCMD.Close

    Hi all

    I got a menu form that contains a sub form which ultimately had another sub form within that sub form, which goes something like this

    1. Menu form
    2. Supplier Form header (SFrm_ExpirySummary)
    3. Supplier details data table (SFrm_SupplierExpiry)

    Form 3 get's it data from a query which contains a where statement that get's it data from a text box in form 2 (that is filled by a dropdown control in the same form)
    Form 2 is simply ran as a sub form in Form 1

    The Query it's trying to run is


    Code:
    SELECT Tble_GrowerDetails.SupplierCode, 
    Tble_GrowerDetails.SupplierName, 
    Tble_GrowerDetails.City, 
    Tble_GrowerDetails.State, 
    Tble_GrowerDetails.PostCode, 
    Tble_QACerts.BaseScheme, 
    Tble_QACerts.SchemeExpiry, 
    Tble_TestResults.ProduceCat, 
    Tble_TestResults.TestType, 
    Tble_TestResults.TestExpiry
    
    FROM ((Tble_GrowerDetails INNER JOIN Qry_Supp_ExpiryStatus ON Tble_GrowerDetails.SupplierCode = Qry_Supp_ExpiryStatus.SupplierCode) INNER JOIN Tble_QACerts ON Tble_GrowerDetails.SupplierCode = Tble_QACerts.SupplierCode) INNER JOIN Tble_TestResults ON Tble_GrowerDetails.SupplierCode = Tble_TestResults.SupplierCode
    
    WHERE (((Qry_Supp_ExpiryStatus.Flag) Like [Forms]![Menu]![Frm_ExpirySummary]![txtCrit]))
    
    GROUP BY Tble_GrowerDetails.SupplierCode, Tble_GrowerDetails.SupplierName, Tble_GrowerDetails.City, Tble_GrowerDetails.State, Tble_GrowerDetails.PostCode, Tble_QACerts.BaseScheme, Tble_QACerts.SchemeExpiry, Tble_TestResults.ProduceCat, Tble_TestResults.TestType, Tble_TestResults.TestExpiry;
    Now I got a problem where if I try to close the menu form via a VBA or Macro it tries to evoke that query and asks for the parameter which ultimately crashes the database, this is despite that the button is simply close form and open an unrelated form

    doesn't try to run it if I hit the X button though or if i simply minimize the Menu form

    There is no macro/vba that I can identify that runs on load

    Any idea?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    Gremlins.
    The only way (IMO) that anyone will be able to pinpoint this for you is if you copy, compact and zip the db and post it here. I'd say it's not the query, it's some code or macro step that you may not realize is executing.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    amcintosh is offline Novice
    Windows 10 Office 365
    Join Date
    Dec 2020
    Posts
    6
    Thanks Micron.

    I've decided to just stick with the work around and minimize the form instead of trying to troubleshoot the issue at this point.

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    I would recommend resolving the issue before moving on as you will eventually need to return to this issue.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  5. #5
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,002
    I suspect it to do with form unloading/loading orders.
    In fact I'm surprised you don't get an issue on load, as the sub form(s) load first so form 3 may not be able to see form 2 properly on load.

    I would try and fix it though.
    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 ↓↓

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

Similar Threads

  1. DoCMD.Close not always working
    By Canadiangal in forum Programming
    Replies: 14
    Last Post: 10-21-2020, 07:08 PM
  2. DoCmd Close Query Not Working
    By bfont in forum Programming
    Replies: 2
    Last Post: 04-16-2020, 03:25 PM
  3. DoCmd.OpenForm based on a query with a parameter
    By RobLoughrey in forum Forms
    Replies: 5
    Last Post: 11-01-2017, 12:29 PM
  4. DoCmd.Close Not Working
    By kdbailey in forum Access
    Replies: 6
    Last Post: 12-11-2013, 07:35 PM
  5. DoCmd.Close OpenArgs NOT WORKING
    By clchris_80 in forum Access
    Replies: 1
    Last Post: 01-19-2013, 09:07 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