Override Date Confirmation


/ Published in: Visual Basic
Save to your folder(s)

Used with calendar button


Copy this code and paste it in your HTML
  1. Private Sub cmdTodayDate_Click()
  2.  
  3. On Error GoTo Err_Handler
  4.  
  5. Dim strAnswer As String
  6. Dim temp As Date
  7.  
  8. If Nz(Me.DateControl) <> "" Then
  9. strAnswer = MsgBox("Do you want to overwrite the existing date?", _
  10. vbYesNo, "Date Exists")
  11. If strAnswer = vbNo Then
  12. Exit Sub
  13. End If
  14. End If
  15.  
  16. Me.DateControl = Format(Now(), "short date")
  17.  
  18. Exit_Handler:
  19. Exit Sub
  20. Err_Handler:
  21. MsgBox "An error has occurred." & vbCrLf & _
  22. "Error Number: " & Err.Number & vbCrLf & _
  23. "Error Description: " & Err.Description, _
  24. vbCritical, "cmdTodayDate_click"
  25. Resume Exit_Handler
  26. End Sub

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.