[AccessD] Using DateDiff function

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Tue Feb 11 12:54:01 CST 2003


Hey, I am trying to make sure a user doesn'y click on  same button twice
in one day by mistake. I wrote this; doesn't work caz LastRun keeps
getting redefined if it starts over. Maybe I should an invisible label to
store latest update date and then check against the label ?

-------------------------------------------------------
Dim LastRun

Private Sub Command20_Click()
Dim Andy

If DateDiff("h", Now, LastRun) <= 15 Then
Andy = MsgBox("You've alredy updated the records today" & vbCrLf & _
        "Are you sure you wish to update again?", vbYesNo, "alert")
  If Andy = vbNo Then
    Exit Sub
  End If
End If
  DoCmd.RunMacro "GetRates"

LastRun = Now
End Sub


-----------------------------------------
Send a Xuppa Valentine to Your Sweetheart today!
http://www.xuppa.com/greet/





More information about the AccessD mailing list