Results 1 to 4 of 4
  1. #1
    QuantifyRisk is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    65

    Setting an event at a certain time

    When a record is created in a table (on a button click), a label is visible that says "Successfully created". I want that to display for 2 seconds then disappear. So I have...

    Dim times As Date
    Const interval As Long = 2000

    DoCmd.GoToRecord , , acNewRec
    Me.success.Visible = True
    times = Now() + interval

    I cannot find anything online where I can put something like:

    If times=Now() then


    me.success.visible=false
    end if

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I think will need to use the form OnTimer event. Beware, timers can be process hogs. I've never used timer in db.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    QuantifyRisk is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    65
    Yeah I figured that. I may just avoid the thing all together and make it disappear on click of the first textbox instead.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    In order to avoid the form's timer and if the pause in time can be off + or - one second, I use this function.

    Code:
    Function Wait(intCount As Integer)
    Dim dblCountEnd As Double
    DoCmd.Hourglass True
        dblCountEnd = DateAdd("s", intCount, Now)
        While DateDiff("s", Now, dblCountEnd) > 0
        Wend
    DoCmd.Hourglass False
    End Function
    You can call it like this

    Code:
    Call Wait(Me.ControlName.Value)
    MsgBox "I waited " & Me.ControlName.Value & " seconds."

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 04-11-2015, 03:54 AM
  2. Setting CheckBox value in form using VBA/Event
    By Monterey_Manzer in forum Forms
    Replies: 7
    Last Post: 05-10-2013, 11:37 AM
  3. Replies: 2
    Last Post: 04-21-2012, 11:17 PM
  4. Auto setting according to system time
    By funkygoorilla in forum Programming
    Replies: 5
    Last Post: 10-30-2011, 07:14 PM
  5. Query-Display next time an event occurs
    By younggunnaz69 in forum Queries
    Replies: 2
    Last Post: 10-23-2011, 05:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums