Timer Count Down

  • Thread starter Thread starter Stockwell43
  • Start date Start date
Doug,

I have one last question:

Is there a way to disable the UserID field once time has expired so no one
can sneak in anymore bids and enable it when a new time is added? I'm asking
because if I am not here in the morning when it expires to disable it
manually I would like for it to disable on it's own. Just a thought not a
biggie.

Thanks!!!
 
Since I don't know exactly how your form is set up, it's difficult to give a
definitive answer, but try:

Private Sub Form_Timer()
Dim varExpiryDtm As Variant

varExpiryDtm = DLookup("ExpiryDtm", "Countdown")
If IsNull(varExpiryDtm) Then
Me.txtTimeRemaining = "No event to countdown."
Me.TimerInterval = 0
Else
If Now() >= varExpiryDtm Then
Me.txtTimeRemaining = varExpiryDtm & " has passed."
Me.TimerInterval = 0
Me.UserID.Enabled = False
Else
Me.txtTimeRemaining = DateDiff("s", Now(), varExpiryDtm) & _
" seconds remaining."
End If
End If

Alternatively (or in addition), use

Me.AllowAdditions = False
Me.AllowEdits = False
 
Douglas J. Steele said:
Sorry, you're the victim of word-wrap in the response.

That msgbox line should be all one line.

This should be correct without word-wrap:

Private Sub Form_Timer()
Dim varExpiryDtm As Variant

varExpiryDtm = DLookup("ExpiryDtm", "Countdown")
If IsNull(varExpiryDtm) Then
Me.TimerInterval = 0
Else
Me.txtTimeRemaining = DateDiff("s", Now(), varExpiryDtm) & _
" seconds remaining."
End If

End Sub

(note that there must be a space in front of that underscore character.)
 
Can anyone help me with a similar problem, I need to close a form after a
specified period of time, this code works perfectly, but is there a way I
can use the on open function to store the current time + say 20 minutes into
the countdown table?
 
Private Sub Form_Open(Cancel As Integer)

Dim strSQL As String

If DCount("*", "Countdown") = 0 Then
strSQL = "INSERT INTO Countdown(ExpiryDtm) " & _
"VALUES(" & _
Format(DateAdd("n", 20, Now()), "\#yyyy\-mm\-dd hh\:nn\:ss\#) & ")"
Else
strSQL = "UPDATE Countdown " & _
"SET ExpiryDtm = " & _
Format(DateAdd("n", 20, Now()), "\#yyyy\-mm\-dd hh\:nn\:ss\#)
End If

CurrentDb.Execute strSQL, dbFailOnError

End Sub
 
Hi, been reading her and seems like a good place to get answers. I need help coding a countdown from a date specified in a txtBox on a form, which is linked to a table. I am not a coder and I just found about Time Interval but have no idea how to use it. Can someone give me a hand?

Thanks,

Steve
 
Hi, been reading her and seems like a good place to get answers.

Yes, it is.... but the people that get the best answers, quickest, ask
specific questions and give detailed information about their forms, tables,
names, etc.

Doesn't "Reverse Countdown" = CountUP??? :D

Sooo, table name, form name, control name, field name??? Countdown in Years,
months, days, hours, minutes, seconds???

Are you counting how many days until Christmas? Until you retire?
 
Back
Top