Hi All,
I’m a bit stuck I want to compare my last transaction date / time which display in a label ‘that I get from the data base’ to the system date / time and if there is a deference of 5 minutes then I get a massage.
I have played around and I do get a massage when the last transaction date is smaller but it doesn’t look for a 5 minute deference even if I use a timer.
Help will be much appreciated’
This is what I’ve got but it’s not doing what I expected
Code:
Private Sub Command1_Click()
Dim date1 As Date
Dim label1 As Date
date1 = Format(Now, "yyyy/mm/dd hh:mm:ss")
date2 = label1
If DateDiff("n", Now, date1) > DateDiff("n", Now, label1) Then
MsgBox ("Not Vending")
End If
End Sub
I try this no luck
Code:
Private Sub Command1_Click()
If DateDiff("n", Now, label1) > 5 Then
MsgBox ("Not Vending")
End If
End Sub
And this no luck
Code:
Private Sub Command1_Click()
Dim date1 As Date
date1 = label1
If DateDiff("n", Now, label1) < 5 Then
MsgBox ("Not Vending")
End If
End Sub
New to date time functions and cant seem to get it right