Here is the code for input Pass: Form, still does not work.
Option Compare Database
Private Sub DestroyedDate_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
OcxCalendar4.Visible = True
OcxCalendar4.SetFocus
If Not IsNull(DestroyedDate) Then
OcxCalendar4.Value = DestroyedDate.Value
Else
OcxCalendar4.Value = Date
End If
End Sub
Private Sub DOB_MouseDown(Button As Integer, Shift As Integer, X As Single,
Y As Single)
OcxCalendar2.Visible = True
OcxCalendar2.SetFocus
If Not IsNull(DOB) Then
OcxCalendar2.Value = DOB.Value
Else
OcxCalendar2.Value = Date
End If
End Sub
Private Sub EXPIRE_DATE_AfterUpdate()
End Sub
Private Sub EXPIRE_DATE_BeforeUpdate(Cancel As Integer)
If IsNull(Me![ISSUE_DATE]) Then
MsgBox "Please select issue date first", vbOKOnly
Me![ISSUE_DATE].SetFocus
Cancel = True
Exit Sub
End If
If CDate(Me![EXPIRE_DATE]) < CDate(Me![ISSUE_DATE]) Then
MsgBox "Expire date must be later than issue date", vbOKOnly
Cancel = True
End If
End Sub
Private Sub EXPIRE_DATE_Change()
End Sub
Private Sub EXPIRE_DATE_Click()
End Sub
Private Sub EXPIRE_DATE_GotFocus()
End Sub
Private Sub EXPIRE_DATE_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
OcxCalendar1.Visible = True
OcxCalendar1.SetFocus
If Not IsNull(EXPIRE_DATE) Then
OcxCalendar1.Value = EXPIRE_DATE.Value
Else
OcxCalendar1.Value = Date
End If
End Sub
Private Sub ISSUE_DATE_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
OcxCalendar.Visible = True
OcxCalendar.SetFocus
If Not IsNull(ISSUE_DATE) Then
OcxCalendar.Value = ISSUE_DATE.Value
Else
OcxCalendar.Value = Date
End If
End Sub
Private Sub OcxCalendar_Click()
ISSUE_DATE.Value = OcxCalendar.Value
ISSUE_DATE.SetFocus
OcxCalendar.Visible = False
End Sub
Private Sub OcxCalendar_Updated(Code As Integer)
End Sub
Private Sub OcxCalendar1_Click()
EXPIRE_DATE.Value = OcxCalendar1.Value
EXPIRE_DATE.SetFocus
OcxCalendar1.Visible = False
End Sub
Private Sub OcxCalendar1_Updated(Code As Integer)
End Sub
Private Sub OcxCalendar2_Click()
DOB.Value = OcxCalendar2.Value
DOB.SetFocus
OcxCalendar2.Visible = False
End Sub
Private Sub OcxCalendar2_Updated(Code As Integer)
End Sub
Private Sub OcxCalendar3_Click()
RETURN_DATE.Value = OcxCalendar3.Value
RETURN_DATE.SetFocus
OcxCalendar3.Visible = False
End Sub
Private Sub OcxCalendar3_Updated(Code As Integer)
End Sub
Private Sub OcxCalendar4_Click()
DestroyedDate.Value = OcxCalendar4.Value
DestroyedDate.SetFocus
OcxCalendar4.Visible = False
End Sub
Private Sub OcxCalendar4_Updated(Code As Integer)
End Sub
Private Sub OcxCalendar5_Click()
PIN_EXPIRES.Value = OcxCalendar5.Value
PIN_EXPIRES.SetFocus
OcxCalendar5.Visible = False
End Sub
Private Sub OcxCalendar5_Updated(Code As Integer)
End Sub
Private Sub PIN_EXPIRES_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
OcxCalendar5.Visible = True
OcxCalendar5.SetFocus
If Not IsNull(PIN_EXPIRES) Then
OcxCalendar5.Value = PIN_EXPIRES.Value
Else
OcxCalendar5.Value = Date
End If
End Sub
Private Sub RETURN_DATE_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
OcxCalendar3.Visible = True
OcxCalendar3.SetFocus
If Not IsNull(RETURN_DATE) Then
OcxCalendar3.Value = RETURN_DATE.Value
Else
OcxCalendar3.Value = Date
End If
End Sub
Private Sub Command45_Click()
On Error GoTo Err_Command45_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command45_Click:
Exit Sub
Err_Command45_Click:
MsgBox Err.Description
Resume Exit_Command45_Click
End Sub
Private Sub Command47_Click()
On Error GoTo Err_Command47_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Command47_Click:
Exit Sub
Err_Command47_Click:
MsgBox Err.Description
Resume Exit_Command47_Click
End Sub
Private Sub Command49_Click()
On Error GoTo Err_Command49_Click
DoCmd.GoToRecord , , acNext
Exit_Command49_Click:
Exit Sub
Err_Command49_Click:
MsgBox Err.Description
Resume Exit_Command49_Click
End Sub
Private Sub REPORTSPAGE_Click()
On Error GoTo Err_REPORTSPAGE_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Reportspage"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_REPORTSPAGE_Click:
Exit Sub
Err_REPORTSPAGE_Click:
MsgBox Err.Description
Resume Exit_REPORTSPAGE_Click
End Sub
Private Sub Command56_Click()
On Error GoTo Err_Command56_Click
DoCmd.GoToRecord , , acPrevious
Exit_Command56_Click:
Exit Sub
Err_Command56_Click:
MsgBox Err.Description
Resume Exit_Command56_Click
End Sub
Private Sub copy_Click()
On Error GoTo Err_copy_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_copy_Click:
Exit Sub
Err_copy_Click:
MsgBox Err.Description
Resume Exit_copy_Click
End Sub
Private Sub Command63_Click()
On Error GoTo Err_Command63_Click
Dim stDocName As String
stDocName = "SPONSOR ORG Query Report"
DoCmd.OpenReport stDocName, acPreview
Exit_Command63_Click:
Exit Sub
Err_Command63_Click:
MsgBox Err.Description
Resume Exit_Command63_Click
End Sub
Private Sub queryname_Click()
On Error GoTo Err_queryname_Click
Dim stDocName As String
stDocName = "Person Search"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_queryname_Click:
Exit Sub
Err_queryname_Click:
MsgBox Err.Description
Resume Exit_queryname_Click
End Sub
Private Sub Command66_Click()
On Error GoTo Err_Command66_Click
Dim stDocName As String
stDocName = "open update close input"
DoCmd.RunMacro stDocName
Exit_Command66_Click:
Exit Sub
Err_Command66_Click:
MsgBox Err.Description
Resume Exit_Command66_Click
End Sub
John Vinson said:
I have a Form Called Input Pass. the Form contains two combo box fields that
are associated with a calender control to enter dates. The combo boxes are
ISSUE DATE and EXPIRE DATE. I want to limit the user from being able to enter
a date in the EXPIRE DATE block that is before the ISSUE DATE block. I hav
tried various combinations of validation rules from the forum and am having
no luck. The input mask for both ISSUE DATE and EXPIRE DATE are
"00\->L<LL\-00;0;_" for medium date. I have tried >[ISSUE DATE] in the
validation rule for EXPIRE Date but it has no effect. I have tried (<=date()
and >[ISSUE DATE]) or null and no effect. I also tried >[Forms]![input
data]![ISSUE DATE] nothing happens.
Any help would be greatly appreciated.
I'd suggest using code in the BeforeUpdate event of the [Expire Date]
combo box (instead of any sort of validation rule):
Private Sub Expire_Date_BeforeUpdate(Cancel as Integer)
If IsNull(Me![Issue Date]) Then
MsgBox "Please select issue date first", vbOKOnly
Me![Issue Date].SetFocus
Cancel = True
Exit Sub
End If
If CDate(Me![Expire Date]) < CDate(Me![Issue Date]) Then
MsgBox "Expire date must be later than issue date", vbOKOnly
Cancel = True
End If
End Sub
You might want to base the Expire Date combo box on a query
referencing the Issue Date combo, and only offering valid dates -
saves the user having to pick a wrong date and getting punished for
it!
John W. Vinson[MVP]