Results 1 to 8 of 8
  1. #1
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138

    In Use Timer

    I have a not so elegant solution to problem, but not sure how to implement it.



    PROBLEM: When a user logs in and begins a certain job, they only have two hours to complete the job before having to complete another materials test. Since I cannot run a timer in the background while they are working on the forms (the whole single threaded issue in VBA), I have the following idea.

    INELEGANT SOLUTION: I am wondering if I can run the timer in the backend (on the server) and have it trigger the material test window opening (modal) in the frontend? I am just to sure how to monitor the timer for the two hour threshold.

    Anyone got any ideas on this? I am all ears (eyes?).

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I guess you could use the server's timer to start a count down. Store it in a function and call it from the front end. This seems complex and you would have to create a table to log user ID's and timestamps. And I am not sure how the server would call a function to open "Material Test Window" on a front end.

    I obviously have not given as much thought as you. The first thing that popped into my head is having a batch file trigger another instance of Access that linked to the BE. A second FE that resides on the client. The splash form could initiate your Material Test Window. You would just need a trigger to run your batch file residing on your client that only has two hours.

  3. #3
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138
    I have only been working in VBA for about a year, and am self (forum) taught. The only way that I know on communicating between the frontend and backend is via a query. While I can get my mind around doing this, it seems really cumbersome and code intensive. As far as batch files go, I am clueless.I could open another instance of Access on the client, but how would I signal the "real" instance when the timer reached 2 hours?

    I have thought of comparing the start time with the current time, but again how do I loop through this on a regular basis while still stopping to allow their work to continue?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    A batch file is a system file and I don't have a lot of experience with them but I have used them to do things that you could do by typing "Run someprogram.exe" in command line. There are batch file editors that you can paste your text into and then generate the system file. Just wondering if this launched a program it could independately communicate to the user. The user's interaction would communicate to the BE.

    Well, a function could run in the background check the log table for changes. Just brainstorming because you mentioned the backend and something about not depending on the client's clock.

    Not sure how it would all come together. Just throwing ideas out there.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Just to stay on topic of a timer. Here is a function you can place in a Global Mod. It is set to count seconds. You could call it in a click event by adding this: Call BeginStop(10) 'where 10 represents the number of seconds it will count down.

    Place the following in a module


    Function BeginStop(intTime As Integer)

    Dim dblCount As Double

    dblCount = DateAdd("s", intTime, Now)

    While DateDiff("s", Now, dblCount) > 0
    Wend

    MsgBox "Time is up"

    End Function

  6. #6
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    I don't know if access can create a windows scheduled task or not. If it can, you could have access check the time when they started the function then create a scheduled task automatically 2 hours out that would eventually notify the user some how.. Opening a simple picture file telling them they need to do another task, or something written in batch or access.

    Here is a link to someone who is created a scheduled task via vba. http://www.dbforums.com/visual-basic...-properly.html

    I have another question though.. does this have to be exactly 2 hours? Or could you say have the access program check then time every 10 seconds.. A simple time check should run so fast I doubt anyone would even notice.

  7. #7
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138
    Many thanks to ItsMe, and redbull. I will look into the scheduled task. It does not have to be exactly 2 hours, just pretty close. I could even check every 5 minutes or so. How would I create/call the check while they are looking at/working with various tabs on a form?

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I would start with building a new table that logged all of the users' activity. However you determine to trigger/fire a function to check the status of any given user, the function would check/reference the activity log for an "Active" record. The function could cause the record to become "Inactive" after 2 hours.

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

Similar Threads

  1. ON TIMER -Always On OK - How to Reset Daily?
    By meg9222 in forum Programming
    Replies: 1
    Last Post: 08-19-2013, 04:39 PM
  2. Timer on IIf Statements?
    By athyeh in forum Programming
    Replies: 4
    Last Post: 07-29-2013, 09:54 PM
  3. Debugger and Timer
    By DepricatedZero in forum Programming
    Replies: 2
    Last Post: 05-29-2013, 01:15 PM
  4. countdown Timer
    By yigitki in forum Programming
    Replies: 16
    Last Post: 11-11-2011, 11:24 AM
  5. Timer object
    By joki in forum Programming
    Replies: 7
    Last Post: 03-17-2011, 08:50 AM

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