Dates

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

How can I have access verify that I did not enter dates
incorrectly. I need the date to be the 26th of the current
month and the current year.

Thanks,

Dennis
 
This example shows how to use the AfterUpdate event of the text box (named
txtDate) to get the user's confirmation to change the date if necessary:

Private Sub txtDate_AfterUpdate
Dim dt As Date
Dim strMsg As String

If Not IsNull(Me.txtDate) Then
If (Day(Me.txtDate) <> 26) Or (Year(Me.txtDate) <> Year(Date)) Then
dt = DateSerial(Year(Date), Month(Me.txtDate), 26)
strMsg = "Should be " & dt & "?"
If MsgBox(strMsg, vbYesNo) = vbYes Then
Me.txtDate = dt
End If
End If
End If
End Sub
 
Thanks Allen!

Dennis

-----Original Message-----
This example shows how to use the AfterUpdate event of the text box (named
txtDate) to get the user's confirmation to change the date if necessary:

Private Sub txtDate_AfterUpdate
Dim dt As Date
Dim strMsg As String

If Not IsNull(Me.txtDate) Then
If (Day(Me.txtDate) <> 26) Or (Year(Me.txtDate)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top