Joe Hecht
jmhecht at earthlink.net
Fri Feb 17 19:51:49 CST 2006
Charlotte,
I will check what you suggested. The problem is, it is going
to the report. Not back to the form which is the desired
behavior.
Joe Hecht
jmhecht at earthlink.net
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Charlotte Foust
Sent: Friday, February 17, 2006 8:01 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] CANCEL WILL NOT CANCEL
Joe,
Have you stepped through this code? The first thing to do
is check and
see what values are in txtAccEndDate and txtAccStartDate.
You are using
IsNull but they could also be a zero length string or zero
(midnight).
I'm not sure what you intend to do with the CANCEL variable,
since you
populate it, but you don't do anything with it.
Charlotte Foust
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Joe Hecht
Sent: Thursday, February 16, 2006 8: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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com