Results 1 to 5 of 5
  1. #1
    mmaule is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2014
    Posts
    38

    InputBox Cancel Button


    How can I determine if the InputBox Cancel button was clicked?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I never thought much about this before. I just check for the value of the user input. If user clicks Cancel the input box value will be an empty string, even if they typed something in the box. If the user does not type something and clicks OK, the value will still be an empty string. If they type something and click OK then the value will be the typed input.
    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.

  3. #3
    mmaule is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2014
    Posts
    38
    My problem is blank, is a valid entry, as in blank, "Mine" or "Yours". and a database field is updated by the value. If Cancel is clicked, I don't want to update the field. With MsgBox I used to be able to test which button was clicked, but I don't remember how I did it.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    MsgBox does not have an input, users can only click the buttons provided. Each button returns a different value.

    If empty string is valid input (I never allow empty strings in records) then I don't think InputBox will suit your requirements. You can build a form to act like an input box but that is trickier coding.
    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.

  5. #5
    mmaule is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    May 2014
    Posts
    38
    Thanks. I guess I'll have to require an entry of "Both", then convert Both to "", to update the field.
    I use the field value to generate an XML output file. If the field is blank, I don't create the optional output tag line.

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

Similar Threads

  1. Cancel Button not working
    By alexandervj in forum Access
    Replies: 16
    Last Post: 02-06-2014, 12:27 PM
  2. Replies: 7
    Last Post: 11-30-2013, 12:33 PM
  3. Cancel button in Quit Macro
    By ashu.doc in forum Forms
    Replies: 3
    Last Post: 09-19-2012, 04:40 PM
  4. Parameter Value Cancel button
    By Darkladymelz in forum Queries
    Replies: 1
    Last Post: 03-14-2012, 04:27 PM
  5. Cancel button for adding data
    By eliotchs in forum Forms
    Replies: 1
    Last Post: 11-21-2011, 04:46 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