[AccessD] CANCEL WILL NOT CANCEL

Darren DICK darrend at nimble.com.au
Fri Feb 17 17:38:02 CST 2006


Hi Joe
Have a look at the last email I sent off list
It has all that sort of stuff in it

Seeya
 


Darren
------------------------------
T: 0424 696 433
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht
Sent: Friday, 17 February 2006 3:10 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] CANCEL WILL NOT CANCEL

The following code is supposed to check that 

 

1.	The start date is not null
2.	The end date is not null.

 

If either is null I want a message box( that works) and when user clicks ok they
go back to form.

 

It is not working. Can any one see why?

 

Thanks

 

Private Sub cmdAccEndDate_Click()

Dim lngRetval As Long

Dim strStDocName As String

Dim lngRetval1 As Long

Dim lngRetval2 As Long

Dim CANCEL As Boolean

 

 

     Me.txtAccEndDate = Me.calAccEndDate  'Sets end date

     

    If IsNull(Me.txtAccStartDate) Then  'Confirm Start Date is not null

            lngRetval1 = MsgBox( _

            "There is no Start Date Entered." & vbCrLf & ""
& vbCrLf & "Please select a Start Date", _

            vbOKOnly + vbCritical + vbDefaultButton1, _

            "PLEASE ENTER START DATE")

 

            Select Case lngRetval1

            Case vbOK

            CANCEL = True

            

            End Select

        End If

        

    If IsNull(Me.txtAccEndDate) Then  'Confirm End Date is not null

    

            lngRetval1 = MsgBox( _

            "There is no End Date Entered." & vbCrLf & "" & vbCrLf & "Please
select a Start Date", _

            vbOKOnly + vbCritical + vbDefaultButton1, _

            "PLEASE ENTER END DATE")

 

            Select Case lngRetval1

            Case vbOK

            CANCEL = True

            End Select

    End If

 

     If Me.txtAccStartDate > Me.txtAccEndDate Then

        lngRetval = MsgBox( _

        "The start date must be the same as, or before the end date of the
report." & vbCrLf & "" & vbCrLf & "Please review  the selected dates and try
your report again", _

         vbOKOnly + vbCritical + vbDefaultButton1, _

         "INCORECT DATE INPUT")

        

        Select Case lngRetval

            Case vbOK

        End Select

    Else

        '              Dim stDocName As String

        

        strStDocName = "30_rptAccidentRegister"

        DoCmd.OpenReport strStDocName, acPreview

        DoCmd.RunCommand acCmdZoom100

        

 

Joe Hecht

jmhecht at earthlink.net

 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list