How can I determine if the InputBox Cancel button was clicked?
How can I determine if the InputBox Cancel button was clicked?
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.
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.
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.
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.