I have a time picker that sets reminders it opens to the current time. I want to make sure the time is increased by 5 minutes when the OK button is clicked
if DTPicker1.value < 5 minutes from now
msgbox "you must increase the time by at least 5 minutes"
Exit Sub
end if
it opens like this:


DTPicker1.CustomFormat = "hh:mm tt"
DTPicker1.Format = dtpCustom
DTPicker1.Value = Now
DTPicker1.Format = 2
it shows the time as AM/PM

have tried this

If DateDiff("n", Time, DTPicker1.Value) < 5 Then
MsgBox "You must increase the time by at least 5 minutes."
End If

and this:
Dim date1 As Date
date1 = CDate(DTPicker1.Value)
If DateDiff("n", date1, Now) < 5 Then
MsgBox ("You must increase the time by at least 5 minutes.")
End If

they do not work

how can this be written ?
Name:  choose time.jpg
Views: 250
Size:  15.6 KB