/ Published in: Visual Basic
Used with calendar button
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Private Sub cmdTodayDate_Click() On Error GoTo Err_Handler Dim strAnswer As String Dim temp As Date If Nz(Me.DateControl) <> "" Then strAnswer = MsgBox("Do you want to overwrite the existing date?", _ vbYesNo, "Date Exists") If strAnswer = vbNo Then Exit Sub End If End If Me.DateControl = Format(Now(), "short date") Exit_Handler: Exit Sub Err_Handler: MsgBox "An error has occurred." & vbCrLf & _ "Error Number: " & Err.Number & vbCrLf & _ "Error Description: " & Err.Description, _ vbCritical, "cmdTodayDate_click" Resume Exit_Handler End Sub