Break Timer

rramon

Registered User.
Local time
Today, 07:26
Joined
May 5, 2003
Messages
30
I need a timer for breaks during training events. So far this is all I have.
2 forms

1st form (frmInput) has 2 text boxes (one for minutes & one for hours) and a command button. Currently the command button closes and opens the 2nd form.

2nd form (frmCountdown) has 3 labels on for hours, one for a semi-colon, and one for minutes.

My question is how do I get the data from the 1st form to show up and countdown to zero on the second form and then exit the application?

Thanks for the help! :)
 

Attachments

Last edited:
I haven't seen your db, but here is a suggestion that I think might be OK for you. (Notice that I've done it fast, without testing it.)

The code behind your button should look like this:
Code:
Private sub MyButton_Click()
    Docmd.Openform "SecondForm"
    SecondForm.lblHours = FirstForm.txtHours
    SecondForm.lblMinutes = FirstForm.txtMinutes
    Docmd.Close "FirstForm"
End sub
Your second form should have the timer property set to 60 000 (1 being 1/1000th of a second).
The timer function should read like this:
Code:
Private sub Form_Timer()
    If lblMinutes = 0 then
        lblHours = lblHours - 1
        lblMinutes = 59
    Else
        lblMinutes = lblMinutes - 1
    End if
    If lblHours = -1 Then Msgbox "GameOver!"
End sub
 
try the attachement
 

Attachments

Maintain Double Digits

Thanks Wild Horse,

The example works great! One question though is there a way to show double digits on the countdown. On seconds for example when it gets to 9 is there a way to display 09?

Newman,

I tried the code you suggested and I'm sure it has to do with the way I have my DB setup but I get an error:

Run-Time error '424':
Object Required

at the following line:
frmFullSizeForm.lblHours = Form2.txtHours (DB Attached)

Thank you both for your help! :)
 

Attachments

behind the close button in first form, change the code to

Forms![frmFullSizeForm]![Label5] = Format([Text0], "00")
Forms![frmFullSizeForm]![Label6] = Format([Text2], "00")


and in Form_timer() procedure of second form, change the code to
[Label5] = Format([Label5] - 1, "00")
[Label6] = Format([Label6] - 1, "00")

with this changes, it suppose to meet your requirement
WH :D
 

Users who are viewing this thread

Back
Top Bottom