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
GetDate:
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!!!
Cliff

--
****************************************
NOTICE TO BULK EMAILER(S):
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!
****************************************

  vcard.vcf
< 1K Download


Thu, 27 Jul 2000 03:00:00 GMT  
 VB5: Canceling an input box...

Quote:

> 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
> GetDate:
> 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!!!
> Cliff

Use the fact that the input box will return a null string to exit your
loop instead of starting it...

if NextDEPOdue = "" then exit Loop ' or something like that

Then start your loop and check for valid entries.



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