Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The use of Timer 1

Status
Not open for further replies.

Jphillis

Technical User
Jun 27, 2001
19
0
0
GB
I have two problems related to time.

P1
I want to start a timer going when i select the Open form Contacts button on a switchboard. The timer must be on a Form Contacts. When the form is closed the time used must then be subtracted from an amount of Time Available, also a text box on form Contacts. The Time Purchased shall be typed in by a user and is also to update the time available.

P2
The timer must go up in steps of 6, ie the timer starts off at 6mins. @ 6:01 the timer moves to 12Mins @ 12:01 the timer jumps to 18Mins etc.

If anyone can help it would be greatfull appreciated.
 
Set the timer running on the OnOpen event of the Form Contacts

Me.TimerInterval = 360000 '6 mins

in the OnTimer event place code to update the Time Available text box

Me.TimeAvailabe.value = Me.TimeAvailable.value - 6

i am presuming this field stores simple minute values, if it is a proper date/time field you have a bit more work.

You can update this field in exactly the same way by using the AfterUpdate event of the Time Purchsed field.
Jamie Gillespie
j-gillespie@s-cheshire.ac.uk
 
Okay.. I haven't used the timers in Access much but I'll give it a shot. In the form_open() procedure for contacts, put the following:

iCounter = 0
me.timerinterval = 1000 this is 1 second

In the Timer procedure on the contact form:
iCounter = iCounter + 1
If you need to display the time, just update the textbox here..

In the Close procedure on the contact form:
me.timerinterval = 0 This will stop the counting. Perform your calculations here to figure out how much time was left.

Its hard to give you specific code because I don't know how your forms are set up.. this is the basic way to use the timer though. Just remember that the timer interval is in milliseconds so 1000 = 1 second, 60000 = 1 min, and 360000 = 6 min.

I hope this helps -Dustin
Rom 8:28
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top