Results 1 to 3 of 3
  1. #1
    Tom Evans is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2023
    Posts
    7

    Disabling or By-passing a Parameter Query CANCEL button

    In MS Access I have a Parameter Query asking for a Job Number and then the data retrieved populates a Form.
    When the Parameter Query window surfaces you now have 2 choices after entering the Job Number these are pressing “OK” or “CANCEL”.
    If OK is clicked the Parameter Query works perfectly and populates the Form.
    If CANCEL is clicked the Parameter Query does not cancel and continues to run but then cannot populate the Form because it has no data and therefore gives errors.
    My question is, is there any way to de-activate or by-pass the CANCEL button?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Most of us use a form to gather user input; it gives you a lot more control. To your question, I don't think so.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    instead of param query, make a form that shows all data,
    put UNBOUND controls on the header area for it to filter the data, user then clicks FIND btn which checks the controls on what to filter:

    Code:
    Public Sub btnFIND_Click()
    Dim sSql As String, sWhere As String
    
    
    sWhere = "1=1"
    
    
        'the query is built depending on the various filters the user picks...
    If Not IsNull(cboState) Then sWhere = sWhere & " and [state]='" & cboState & "'"
    If Not IsNull(txtName) Then sWhere = sWhere & " and [Name]='" & txtName & "'"
    If Not IsNull(chkContact) Then sWhere = sWhere & " and [Contact]=" & chkContact.Value
    
    
     'use it to filer the form records
    if sWhere = "1=1" then
      me.filterOn = false
    else
      me.filter = sWhere
      me.filterOn = true
    endif
    END SUB

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

Similar Threads

  1. Passing a query parameter to a report
    By clancy76 in forum Access
    Replies: 3
    Last Post: 07-02-2020, 03:25 PM
  2. Passing parameter form value to a query result
    By OtakiriLad in forum Queries
    Replies: 3
    Last Post: 11-27-2015, 09:25 PM
  3. Passing parameter from form to query
    By rhubarb in forum Forms
    Replies: 3
    Last Post: 05-03-2015, 10:29 AM
  4. Passing textbox value into sql query parameter
    By gustavoavila in forum Access
    Replies: 7
    Last Post: 04-23-2014, 04:00 PM
  5. Parameter Value Cancel button
    By Darkladymelz in forum Queries
    Replies: 1
    Last Post: 03-14-2012, 04:27 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