VB5: Canceling an Input Box? 
Author Message
 VB5: Canceling an Input Box?

How can I allow a user to click CANCEL and exit this sub:

StopLoop = False
Msg = "Enter the date you want to search for" & vbCr & "leave blank
for today's date:  "
Title = "Next DEPO Date Search"
Default = Date
NextDEPOdue = InputBox(Msg, Title, Default, vbOKCancel)
    If NextDEPOdue <> "" Then
        If Not IsDate(CDate(NextDEPOdue)) Or Err.Number > 0 Then
           NextDEPOdue = MsgBox("Invalid Date!!!", vbOKOnly, Title)
           Default = Date
           Err.Number = 0
           GoTo GetDate
           NextDEPOdue = CDate(NextDEPOdue)
           StopLoop = True
        End If
        StopLoop = True
    End If

All help will be appreciated!!!

Pursuant to US Code, Title 47, Chapter 5,
Subchapter II, 227, any & all unsolicited
commercial e-mail sent to this address is
subject to a download and archival fee in
the amount of $500 US and copies will be
forwarded to domain administrators--
E-mailing denotes acceptance of said terms!

< 1K Download

Wed, 26 Jul 2000 03:00:00 GMT  
 VB5: Canceling an Input Box?

>This is a multi-part message in MIME format.

>How can I allow a user to click CANCEL and exit this sub:

>StopLoop = False
>Msg = "Enter the date you want to search for" & vbCr & "leave blank
>for today's date:  "
>Title = "Next DEPO Date Search"
>Default = Date
>NextDEPOdue = InputBox(Msg, Title, Default, vbOKCancel)
>    If NextDEPOdue <> "" Then
>        If Not IsDate(CDate(NextDEPOdue)) Or Err.Number > 0 Then
>           NextDEPOdue = MsgBox("Invalid Date!!!", vbOKOnly, Title)
>           Default = Date
>           Err.Number = 0
>           GoTo GetDate
>        Else
>           NextDEPOdue = CDate(NextDEPOdue)
>           StopLoop = True
>        End If
>    Else
>        StopLoop = True
>    End If

>All help will be appreciated!!!

I'm not sure you can unless the user changes the default
text before clicking the Cancel button. It returns either
the text in the input box or "" if its left blank.

Frankly, I think the cancel button is there just in case
someone changes the Default text in the control and then
decides to abort when they can't make up thier mind what
to type in. :)

Thu, 27 Jul 2000 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. VB5: Canceling an input box...

2. Cancel Input Box

3. Canceling an Input Box?

4. Cancel button on Input Box

5. Capture cancel in input box?

6. Getting rid of the cancel button in input box

7. Testing for Cancel in Input Box

8. Input Box Cancel Command

9. VB5 Input Box Question

10. Input box for currency data - vb5

11. Formatting date input in Input Box

12. Canceling input In Visual Basic


Powered by phpBB® Forum Software