I have a button with the following code attached,
Private Sub btnAdd_Click()
On Error GoTo Err_btnAdd_Click
txtTimeNow = Now
If txtLastPall < ((DateAdd("n", 0, txtTimeNow)) - 30) Then
MsgBox "Too soon to have made another Pallet", vbInformation, "Not Possible"
txtLastPall = Time
txtPallDate = Date
txtPallTime = Time
Me.Dirty = False
DoCmd.GoToRecord , , acNewRec
all the text boxes are hidden
txtLastPall is unbound and txtTimeNow is unbound.
In Line 4 I am trying to get the message to display if the button is clicked too soon.
i.e.the button should display the message if less than 30 minutes has elapsed since the last time it was clicked.
I have tried many variations of the DateAdd formula in Line 4 but cannot get it to do what I need.
Please point me in the right direction.
As always, your time is appreciated.
Thanks in advance