Results 1 to 5 of 5
  1. #1
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170

    Timer on IIf Statements?

    Is there anyway to set a timer on an IIf Statement?

    For example:

    I have:
    Combobox1: "BangNails"


    Combobox2: "Lunch"
    Textbox: "Goal"
    Textbox: "Adj Goal"

    Currently in Goal field:
    IIf(Combobox="BangNails", "35", "0")

    Currently in Adj Goal field:
    IIf(Combobox="Full Shift", [Goal], IIf(Combobox="Lunch", [Goal]*.5, "0"))

    Is there anyway to make it so that at the end of 60 minutes, the combobox resets to "Full Shift" so that Adj goal field resets to Goal or "35"?

  2. #2
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    The timer wouldn't be on the IIF statement. The timer would be on the form (or another form).

    When the user selects "Lunch", your combobox's After Update event will set the form's TimerInterval property to whatever duration you want (1000 = 1 second), and the form starts its countdown.

    If the user takes an action that you want to reset the delay factor, then you would set the TimerInterval again.

    If the user takes an action that you want to turn off the timer, set the TimerInterval to 0.

    When the form timer hits its countdown, then it would change the setting of the combo Box, and set the TimerInterval to zero.

  3. #3
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170
    Scratch that last post. I've got the timer and it is requerying my statement but how do I get it to set my Dcount function back to zero, for the new hour (In this case 10 seconds)?

    Private Sub Combo68_AfterUpdate()
    If Me![Combo68] = "Break" Then Me![Goal] = ([Text72] * 0.75)
    If Me![Combo68] = "Full Shift" Then Me![Goal] = ([Text72])
    If Me![Combo68] = "Lunch" Then Me![Goal] = ([Text72] * 0.5)
    Me.TimerInterval = 10000
    End Sub

    Private Sub Form_Timer()
    Me!Text64.Requery
    End Sub

    Text64 =DCount("LID","tblMainDB","Operator = '" & [Forms]![tblMainDB]![Operator] & "'")

  4. #4
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    There doesn't seem to be any time constraint on your DCount, so there's nothing to set to zero.

    If you plan to track things before lunch/after lunch, or by hour, or something like that, you'll need to concatenate "AND " with a second test into the last parameter of your DCount function.

  5. #5
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170
    Quote Originally Posted by Dal Jeanis View Post
    by hour, or something like that, you'll need to concatenate "AND " with a second test into the last parameter of your DCount function.
    By hour is exactly what I'm looking for. Can you elaborate on what you mean by, "concatenate" (don't know what that means) and what the second test into the last parameter of my DCount function?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Debugger and Timer
    By DepricatedZero in forum Programming
    Replies: 2
    Last Post: 05-29-2013, 01:15 PM
  2. countdown Timer
    By yigitki in forum Programming
    Replies: 16
    Last Post: 11-11-2011, 11:24 AM
  3. Button with timer. Help Needed please!
    By oriongate in forum Forms
    Replies: 5
    Last Post: 07-18-2011, 02:44 PM
  4. Timer object
    By joki in forum Programming
    Replies: 7
    Last Post: 03-17-2011, 08:50 AM
  5. Closing the application with some timer
    By reachvali in forum Programming
    Replies: 1
    Last Post: 05-18-2010, 11:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums