T
Tandy
Right now I have a form with the following code:
-----------------------------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
Dim strShowYear As String
Dim blnDone As Boolean
' Prompt the user for the year to be shown initially.
' We'll suggest next year as a default.
' In case of erroneous entry, continue prompting until
' a valid year is given, or the prompt is cancelled.
Do
strShowYear = InputBox( _
"What year do you want to edit?", _
"Enter Year", _
CStr(Year(Date) + 1))
Select Case True
Case (Len(strShowYear) = 0)
Cancel = True
blnDone = True
Case (Not IsNumeric(strShowYear)), _
(Val(strShowYear) < 1800), _
(Val(strShowYear) > 5000)
MsgBox "That's not a valid year!", _
vbExclamation, "Invalid Entry"
Case (Val(strShowYear) < (Year(Date) - 10)), _
(Val(strShowYear) > (Year(Date) + 10))
If MsgBox( _
"You entered " & strShowYear & _
", which seems odd. " & _
"Are you sure?", _
vbQuestion + vbYesNo, _
"Please Confirm") _
= vbYes _
Then
blnDone = True
End If
Case Else
blnDone = True
End Select
Loop Until blnDone
If Cancel <> True Then
Me.txtShowYear = strShowYear
Me.Requery
End If
End Su
-----------------------------------------------------------------------------------------------
This code was used to prompt the user of my form about what year they would
like to enter. Now I am making a form that will go by month and will need my
user to be prompted about the day, month and year they would like to enter.
My date is in short date format (1/1/2005). I have tried to change the code
myself, but I'm afraid I have no idea what I am doing. Please help!
-----------------------------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
Dim strShowYear As String
Dim blnDone As Boolean
' Prompt the user for the year to be shown initially.
' We'll suggest next year as a default.
' In case of erroneous entry, continue prompting until
' a valid year is given, or the prompt is cancelled.
Do
strShowYear = InputBox( _
"What year do you want to edit?", _
"Enter Year", _
CStr(Year(Date) + 1))
Select Case True
Case (Len(strShowYear) = 0)
Cancel = True
blnDone = True
Case (Not IsNumeric(strShowYear)), _
(Val(strShowYear) < 1800), _
(Val(strShowYear) > 5000)
MsgBox "That's not a valid year!", _
vbExclamation, "Invalid Entry"
Case (Val(strShowYear) < (Year(Date) - 10)), _
(Val(strShowYear) > (Year(Date) + 10))
If MsgBox( _
"You entered " & strShowYear & _
", which seems odd. " & _
"Are you sure?", _
vbQuestion + vbYesNo, _
"Please Confirm") _
= vbYes _
Then
blnDone = True
End If
Case Else
blnDone = True
End Select
Loop Until blnDone
If Cancel <> True Then
Me.txtShowYear = strShowYear
Me.Requery
End If
End Su
-----------------------------------------------------------------------------------------------
This code was used to prompt the user of my form about what year they would
like to enter. Now I am making a form that will go by month and will need my
user to be prompted about the day, month and year they would like to enter.
My date is in short date format (1/1/2005). I have tried to change the code
myself, but I'm afraid I have no idea what I am doing. Please help!