Hi All;
Newbie to VB6 please help, Struggling with something I just can’t get right, label1 display a last transaction date/time which I get from a date base throw a query label2 is the system date/time. I have a timer that execute a command button after executing the command button I want to check if the date/time in label1 is smaller than 5 minutes and if so then I get a massage. But I don’t know how all my code fails to perform this function help will be much appreciated.
Private Sub Command1_Click()
Dim date1 As Date
Dim date2 As Date
date1 = Format(Now, "yyyy/mm/dd hh:mm:ss")
date2 = Format(label1, "yyyy/mm/dd hh:mm:ss")
If DateDiff("n", date1, date2) < 2 Then
MsgBox ("Not Vending")
End If
End Sub
ALSO
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("m", Now, date1) > DateDiff("m", Now, label1) Then
MsgBox ("Not Vending")
End If
End Sub
Also
Private Sub Command1_Click()
If DateDiff("n", Now, label1) > 5 Then
MsgBox ("Not Vending")
End If
End Sub