Results 1 to 9 of 9
  1. #1
    bgarey is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    33

    Scoreboard Timer

    I want to make a scoreboard (countdown) timer on a form that my children can use for basketball games.
    I do not know visual basic. I know there are VBA codes for this, and I can cut and paste. But I need step by step instructions on how to set this up.


    Any help?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    In a form, put a label...lblTime. Set it to your start time.
    In the form property is timer. Set it to 1000. This is 1 second.
    in the events, ON TIMER
    this event will now fire every second
    so we set the label to change every time
    lblTime.caption =dateadd("s",-1, lblTime.Caption )

    you can also set the on key down event if the user presses space bar, it will pause the timer...
    which would be timer interval =0

  3. #3
    bgarey is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    33
    Sorry it has taken so long to get back.
    I really am a novice here.
    I copied the code into the events procedure for the ontimer.
    But I am just getting an error.
    Not sure about any of this.

  4. #4
    bgarey is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    33
    Ok I have a timer that counts down now.
    Thanks
    But how do I format the label for just minutes and seconds
    mm:ss
    and how do I set the initial time, for example 07:00?

  5. #5
    bgarey is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    33
    I would also like a button that starts the timer, pauses it, and a reset.
    A buzzer when it gets to Zero.

    Any help?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    A label cannot be 'set' for data display formats. Can use Format() function.

    lblTime.Caption = Format(DateAdd("s",-1, lblTime.Caption), "nn:ss")

    However, because the Format function results in a string, not actually a date/time value, the calculation will likely error. So instead of label use a textbox. Textbox does have property for data formatting.

    The only example of a stopwatch I could find is a VB6 project. VB and VBA code are very similar. If you have VB6, can open the project and view the code. It would probably be adaptable to VBA. I have done that before. http://www.freevbcode.com/ShowCode.asp?ID=8560
    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.

  7. #7
    bgarey is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    33
    Thanks so much! I now have a score board timer. I can start, pause, reset the clock. And I have learned a little VBA along with it. I can make it "beep" when zero. But I would like it sound off a buzzer sound. My if then statement works for stopping the timer and the "beep".
    What is the code for playing a sound file?
    And thanks for the help so far!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Bing: Access sound file

    http://allenbrowne.com/func-04.html
    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.

  9. #9
    bgarey is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    33
    Thanks to all!
    This really works. I just have to add in scoring for home and away teams, but I got that part.
    Click image for larger version. 

Name:	Scoreboard.PNG 
Views:	19 
Size:	38.1 KB 
ID:	21356

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

Similar Threads

  1. In Use Timer
    By dccjr in forum Programming
    Replies: 7
    Last Post: 09-18-2013, 12:40 PM
  2. Timer on IIf Statements?
    By athyeh in forum Programming
    Replies: 4
    Last Post: 07-29-2013, 09:54 PM
  3. Debugger and Timer
    By DepricatedZero in forum Programming
    Replies: 2
    Last Post: 05-29-2013, 01:15 PM
  4. countdown Timer
    By yigitki in forum Programming
    Replies: 16
    Last Post: 11-11-2011, 11:24 AM
  5. Timer object
    By joki in forum Programming
    Replies: 7
    Last Post: 03-17-2011, 08:50 AM

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