X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Countdown Timer    
Jeffrey Nolan
post Sep 7 2015, 01:58 AM

Posts: 103
Joined: 11-February 00
From: Anacortes, WA.

writing countdown timer.
Form has 5 text boxes
txtCurrentTime (computer time)
txtPlusMinutes (user input)
txtSetStopTime (user input)
Actual Stop Time (txtCurrentTime + txtPlus minutes)
txtTimeRemaining (in minutes, differance of txtStopTime - txtCurrentTime)

Three Command Buttons
1. Enter Plus Minutes
2. Enter Stop Time
3. Close

so far I have not been able to get passed the the following without getting an error message.

Option Explicit

Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub tmrStopWatch_Timer()
tmrStopWatch.Interval = 1000
txtNow(0).Text = Time

End Sub

Private Sub cmdEnterPlusMinutes_Click()

Dim intPlusMinutes As Integer
Dim timeActualStartTime, timeActualStopTime As Date
intPlusMinutes = Str(txtPlusMinutes)
timeActualStartTime = Time()
timeActualStopTime = DateAdd("n", intPlusMinutes, timeActualStartTime)
Me.txtActualStopTime = timeActualStopTime
{the error message happens here for txtActualStopTime and reads: Compile error: Arguement not optional}

End Sub

Any ideas for getting me pointed in the correct direction?

Go to the top of the page
Doug Steele
post Sep 7 2015, 06:39 AM

UtterAccess VIP
Posts: 22,228
Joined: 8-January 07
From: St. Catharines, ON (Canada)

Me.txtActualStopTime.Text = timeActualStopTime

BTW, your declaration statement doesn't do what you likely think it does.

Dim timeActualStartTime, timeActualStopTime As Date

declares timeActualStopTime as a Date variable, but timeActualStartTime is a Variant. You cannot "short circuit" declarations. You must repeat the type each time:

Dim timeActualStartTime As Date, timeActualStopTime As Date
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    13th December 2019 - 10:55 AM