Results 1 to 3 of 3
  1. #1
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    101

    Why do I get prompted for a Parameter Value sometimes for the same code that usually doesn't prompt?

    I am supporting an Access 2016 application for a delivery company. The following bit of SQL is executed each day for every vehicle in the fleet. And it works (almost) all the time.
    But on occasion for no apparent reason I get the “Enter Parameter Value” prompt for [Forms]![frmShowDailySchedule]![txtEndDate]


    INSERT INTO tblDailyLoadingList (
    Vehicle,
    ProductID,
    ProductName,
    DeliveryDate,
    seqp )"
    SELECT


    tblTempOrders.Vehicle,
    tblTempOrders.ProductID,
    tblTempOrders.ProductName,
    [Forms]![frmShowDailySchedule]![txtEndDate] AS Expr1,
    tblProducts.[seqp:]"
    FROM (tblTempOrders
    INNER JOIN tblProducts
    ON tblTempOrders.ProductID = tblProducts.ProductID)
    INNER JOIN tblEggStockType
    ON tblProducts.EggStockType = tblEggStockType.EggStockTypeID"
    GROUP BY tblTempOrders.Vehicle,
    tblTempOrders.ProductID,
    tblTempOrders.ProductName,
    tblEggStockType.SortOrder,
    tblProducts.[seqp:];"

    If I insert a MSGBOX for [Forms]![frmShowDailySchedule]![txtEndDate] just before entering the SQL it shows that there is a valid date in the item.
    So I cannot understand why occasionally this happens. Once it does happen for a particular vehicle it keeps happening. But swop to another vehicle and it works OK

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you get the prompt if that form is not open.
    make sure the form is open and the txtEndDate is filled.

    in the query , you can also add the PARAMETER : [Forms]![frmShowDailySchedule]![txtEndDate] as date

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Are you running this in a loop? Then might be better to assign the value to a variable and concatenate it into the sql. I suspect that if you leave in the message box the prompt never happens.
    Please paste code (including sql) in code tags - # on posting toolbar - to prevent forum from doing things to it.
    What's with the interspersed quote marks there?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 4
    Last Post: 06-15-2020, 02:18 PM
  2. Replies: 2
    Last Post: 07-13-2019, 02:45 PM
  3. Why am I being prompted to enter a parameter?
    By Access_Novice in forum Queries
    Replies: 2
    Last Post: 09-15-2014, 02:41 AM
  4. Why am I still being prompted after I deleted the code?
    By Access_Novice in forum Programming
    Replies: 5
    Last Post: 01-06-2014, 07:28 PM
  5. Web Report doesn't prompt for parameters
    By coverman in forum SharePoint
    Replies: 1
    Last Post: 03-09-2012, 04:16 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