UtterAccess.com
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
Post#1



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
Post#2


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


CODE
Me.txtActualStopTime.Text = timeActualStopTime


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

CODE
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:

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


Custom Search
RSSSearch   Top   Lo-Fi    18th December 2017 - 09:45 AM