Microsoft Access Run-time Timer Event No Firing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DJRhino1175
    New Member
    • Aug 2017
    • 221

    Microsoft Access Run-time Timer Event No Firing

    I'm running the following code in the timer event section when my database opens. It works on the my Office 365 version, but doesn't seem to fire on the run-time version of access. My database is on a network in a FE/BE setup. There is a yes/No box in my table called "ztblSystemStat us". When I uncheck this box and close out the timer should run out and this code should run and close out the front end's that I have out on the manufacturing floor which use access run-time. I have let it sit for over 5 mins on a 1 minute timer(60000 milliseconds). When it works correctly it pops up a popup form with a message that the database is going down for maintenance in 10 secs....but nothing happens. I open mine and sure enough after 1 minute the message pops up and then closes 10 secs. later. Any idea on how I can get runtime to work with this setp?


    Code:
    Private Sub Form_Timer()
    
    'Checks system status
    Dim varRetVal
        varRetVal = DLookup("SystemUP", "ztblSystemStatus")
        If Nz(varRetVal, 0) = 0 Then
            DoCmd.OpenForm "frmSystemExit", acNormal
        End If
    
    End Sub
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    Hi DJ.

    I suspect this is an issue with code running at all in the environment where it's failing. I suggest you do some tests on those PCs and see if you can get some simpler code to run and show you it is. MsgBox() is good for such things.

    Things to consider when code doesn't run are :
    AV software.
    Access security settings.
    Code Signature status of project.
    Location of project file (ACCD(B/E) or MD(B/E)) (Safe Locations).

    Once you've figured out whether code even runs or not, then you can worry about the actual code you want to use.

    Comment

    • DJRhino1175
      New Member
      • Aug 2017
      • 221

      #3
      This works on all Office 365 Access installs except for the runtime . All front ends are in the same location weather they are runtime or not. All other codes I have work just fine. Its only this timer event that doesn't work with runtime. Not sure about security settings for runtime as there isn't a ribbon or anyway for me to go into security settings, at least that I know of.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Hi DJ.

        If you report on what tests you did and the results of those tests in the different environments then we will have a clearer understanding of what's what and I can know you actually ran tests rather than remember from before. It takes work. I will need properly explained tests and results rather than you just jotting down a couple of ideas.

        How did you check for AV?
        What did you do to test that other code runs using the runtime? Does a basic MsgBox() call work from a simple Timer event (Simple == Form design rather than turning on the timer using code). That is not an exhaustive list but just some illustrative examples. See earlier post for items that need to be dealt with.

        PS. No promises (except to try for you). This wouldn't be here if it were a simple problem.
        Last edited by NeoPa; Feb 1 '23, 01:24 AM.

        Comment

        • DJRhino1175
          New Member
          • Aug 2017
          • 221

          #5
          I have a timer event on the form that is 120,000 milliseconds. The code above checks in a table whether "systemUp" yes/no Box is checked or not. If its checked the system is up and running(Not in maintenance mode). If the box is unchecked then it triggers the above code. This code then triggers a pop up form that has a 10 second timer on it which then quits access. So what I have done to test this is uncheck the box in the table while my front end is open and waited till it closed down. This works perfectly for me and anyone else with a full version of access. All front ends are located in the same folder of a network drive. All front ends are made from a copy of my front end and renamed. All the front ends that are used out on the production floor are opened with Access Runtime installed. These are the ones that will not close out as they should. Everyone that access that folder has the same rights to the database. I'm just not sure why this would work on the full version of access but not runtime, because in theory it should as runtime only has the design elements stripped from it.

          Thanks Neo for your help. Hopefully I explained it better.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            Originally posted by DJRino
            DJRino:
            Hopefully I explained it better.
            It was never about failing to understand your situation DJ. Possibly the reverse from what I see. I'm trying to make it clear what you need to do (with my help where I can) in order to discover what your problem is.

            I understand the logic of what you're trying to do. And, it should be added, are succeeding in doing under some circumstances. This doesn't take us forward at all though. I tried to explain a bit in my other posts but it seems we're a little at cross-purposes here. Rather than worrying about the logic of your code - which from what we know so far is probably quite adequate - we need to look elsewhere and try to discover exactly what is different where in the environments that don't work as expected.

            For this we need to look at running some exclusion tests. If you are still interested (I know this won't be simple work, and it's more involved due to explaining by the written word rather than using more immediately interactive methods, so you may choose not to get involved).

            When testing out concepts it's important to simplify as much as humanly possible. EG. Does code run at all in the environment being tested? Create a separate database just for testing and get it to run as simple a bit of code as possible. Testing code you know runs elsewhere is simply not good enough. There are 1,000,001 different reasons why that particular code may have problems in the environment. So, to avoid even having to think about whether or not a test is worthwhile with existing code, we always strip to the very basics.
            Code:
            Private Sub Form_Open(Cancel As Integer)
                Call MsgBox("Test")
            End Sub
            For a Timer event you may want something that changes between firing so you can see it's ongoing. For instance have a Label control on the Form with code of the form :
            Code:
            Private Sub Form_Timer()
                Static lngX As Long
            
                lngX = lngX + 1
                Me.lblX.Caption = lngX
            End Sub
            Only when you know what is causing the issue can you consider the best way to correct it. As I said before - ensure the Timer is working by design and not reliant on code to trigger it.

            Now, please refer back to earlier posts for required information. I still have nothing from you relating to AV software. It would also be helpful to know how a workstation that gets upgraded to full Access (rather than RunTime), without any other changes, behaves. It should be ok to return it to RunTime once we no longer need info from it.

            I will certainly understand if you choose not to take this route, but I see no other way to garner the info you require. Certainly this situation is not one I've dealt with before.

            Comment

            • DJRhino1175
              New Member
              • Aug 2017
              • 221

              #7
              Neo,

              I'll try what you asking. with a blank Database with the codes you listed.

              AV software is, to me at lest, looks like they are just running windows security.

              Due to a cost cut, they uninstalled 365 from most of the accounts and installed free versions of Word and excel. I had them install Access Runtime as only developers needed the full version to create databases.

              The database were are running is a .accdb and not what ever extension it is for run time...Hope that helps a little more. In the mean time I will try and make a basic database and use the code provided and report on my findings.

              Thanks,

              DJ

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32633

                #8
                If your technical people (who install the software) don't mind the extra work you give them then please ask them to install the full version of Access (temporarily) onto one of the PCs only, as a test workstation. It needn't be licensed as short-term testing doesn't require one as far as I understand (I'm not a licensing expert but I am an Access MVP so have what I believe is a decent understanding of such things). Once we have what we need from it then we can allow it to revert to the Runtime version.

                Comment

                • DJRhino1175
                  New Member
                  • Aug 2017
                  • 221

                  #9
                  Ok, I tried the stripped down database with the one table and the code above and 2 forms. One is the pop up box that says closing in 10 secs. The other form is just a dummy form with buttons on it that do nothing. In the first try it worked on my PC and 1 of the production line pc's...The timer is set for 20000 milliseconds on this test database.

                  We only have a reginal IT guy who is here 2 days a week. I rarely have access to him.

                  Could the problem be that I close this main form when they open their data entry form?

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32633

                    #10
                    Hi DJ.

                    It looks like this is going to be too complex for us to work together on. Such work would require precise following of instructions and clear reporting of the results. Capabilities for both seem to be absent. I know I have a tendency to explain things at a level some will struggle with.

                    To be fair, such a problem being determined remotely was always going to be a big ask. never mind. I think we gave it a good try.
                    Originally posted by DJRhino
                    DJRhino:
                    Could the problem be that I close this main form when they open their data entry form?
                    With so little pertinent data I have no way of knowing :-(

                    PS. Please don't interpret my comments as a criticism of you personally. Being able to communicate well technically is a rare capability. You're unfortunate to have a problem that requires it.

                    Comment

                    • DJRhino1175
                      New Member
                      • Aug 2017
                      • 221

                      #11
                      I did get this to work. I need the code to be on the form that is open all of the time and not my start up form.

                      Thanks for the attempt to help.

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32633

                        #12
                        Hi DJ.

                        Well, I missed that. The form this Timer Event is actually designed within is the one that gets closed? I rather misinterpreted what you meant there.

                        Yes indeed. My earlier response should have been that closing the Form associated with the Timer certainly would cause it to stop working. I was still working on the logic, explained in your first post, that it worked fine on your system so the difference had to be something on their system. If your testing was so far mismatched from the actual usage then that would certainly allow for the possibility of it being something else entirely.

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32633

                          #13
                          As a quick addition to that DJ, what I do is to design a Form that works as both a Startup one and a permanent one (One that closes when, and only when, the database itself closes.) and when you no longer want the Startup part to show then simply hide it rather than close it. That way all your clever stuff that needs to be available all the time is always open when your project is running.

                          I also have code in my main (Startup) form that repeatedly checks for a message telling it to close down (for the allowance of maintenance tasks).

                          Comment

                          • DJRhino1175
                            New Member
                            • Aug 2017
                            • 221

                            #14
                            Thanks Neo, I forgot all about the hide form feature.

                            Comment

                            Working...