How to Program Access to Close Automatically when No Activity

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • Make Access Program to Close Automatically when there is no activity by a set minutes.

КОМЕНТАРІ • 46

  • @Jim-nu6ux
    @Jim-nu6ux 2 роки тому

    This works great. Just what I needed for a work database where the guys leave the database open when they go home and I can't work on it unless I unplug their computer. Thank you very much. Well worth a follow.

  • @michaelmascari9785
    @michaelmascari9785 4 роки тому +1

    Fantastic! Clear and effective instructions. Thank you so much!!

  • @zuesking1974
    @zuesking1974 6 років тому

    Thanks. This works great! I change the code to run in seconds rather than minutes and set the timer to 300 seconds to close after 5 minutes to close.

  • @MichaelTrezor
    @MichaelTrezor Рік тому

    Amazing video!!! Thank you very much. You have saved my life 🥳🥳🥳

  • @mahmoodsheikh4046
    @mahmoodsheikh4046 4 роки тому +1

    U r really great teacher 😍

  • @sbaud2003
    @sbaud2003 6 років тому +1

    excellent tutorial thank you sir.......

  • @nealrayce
    @nealrayce 7 років тому

    This is exactly what i was looking for thank you!!!!!!!!

  • @khaldounkahaleh9904
    @khaldounkahaleh9904 4 роки тому

    great explanation, code works in good mode, i had added some features, allowed user to cancel or resume the countdown

  • @franksmit4914
    @franksmit4914 11 місяців тому

    Works well, thank you !!!

  • @vbaaccess1365
    @vbaaccess1365 8 років тому

    Absolutely brilliant!
    Thanks a lot for video.

  • @ShrutitPatel
    @ShrutitPatel 5 років тому

    Saved life! Thank you so so much.

  • @Nerosis1916
    @Nerosis1916 4 роки тому

    This helps alot! Thank you! I do have a question, does this code work for a form with multiple layers? That is a form within a form

  • @obbc9747
    @obbc9747 Рік тому

    Thanks, great explanation

  • @DanWalters87
    @DanWalters87 3 роки тому +1

    I have used your code however i cant see what i've done different. my code is exactly the same as yours however when I view the form the counter doesn't start and nothing happens. Timer interval set to 1000 and on timer set to event with the code. are there any behind the scenes settings or references need to be checked?

    • @suzukyotoltd8143
      @suzukyotoltd8143 11 місяців тому

      same for me, counter never starts, did you get any solution?

  • @rufi4you
    @rufi4you 8 років тому +2

    @Austin, I have implemented this feature in my DB But this feature only works if if my DB is active in the foreground In other words, is my DB minimized or I work in another e.g. Word or Excel windows this feature do not working. My users work with other tools and because it would be nice if it then especially the DB closes. Sorry everything else does not make sense. @Austin, do you have to a solution for this? Thanks

  • @jungjungdelosreyes4147
    @jungjungdelosreyes4147 2 роки тому

    Hi sir can you please help to include also when open report still it will quit. Thank you sir Teawan. Appreciate a lot on this wonderful video.

  • @JWEERASINGHE
    @JWEERASINGHE 4 роки тому

    Thank you very much,

  • @johargamer101
    @johargamer101 3 роки тому

    Beauty speaking thanks

  • @SuryaHartono84
    @SuryaHartono84 5 років тому

    Very nice tutorial. Can you please help me if there is no ActiveForm selected, just like when click outside the form or click outside of the application, I want the timer is also ticking.

  • @scottaxton2513
    @scottaxton2513 8 років тому

    Tewan - Excellent video and concepts. I found your videos only a couple weeks ago and have learned a lot so far!
    My database is split into front-end/back-end. I'm assuming this would need to be in the front-end files. Is that correct?
    If that is so my Idea might not work - maybe you have another suggestion for this thought:
    Could this same type of function be used from an "admin" tool to force all users off the database? My thought would be to put a value in a table and have it look at that value. If the value for [status] = Normal no action to be taken - if the value for [status] = Shutdown then log off all users so maintenance could be performed. Table updates, Backup, anything requiring exclusive mode. You could even broadcast a message box telling them the database is being shut down in 15 Minutes etc.....
    You have provided me inspiration to try some things!! Thanks - Scott

    • @austin72406
      @austin72406  8 років тому

      yes, Scott. you can set up like you said.

    • @arianmarshal1
      @arianmarshal1 6 років тому

      Hi Austin, Thanks for the video, It works great on the Backend version, However when I publish it in a .accde format it does not work? Do you know how I can fix it or perhaps have a video for the front end as well? Many Thanks

  • @brianklanjscek8154
    @brianklanjscek8154 5 років тому

    Question,
    This works perfectly, the only issue I have today is if anyone has a Report open the timer never starts. How can I fix that?

    • @donnahamby1557
      @donnahamby1557 5 років тому +1

      Hi Brian, I am having this same issue with a report being left open. Were you able to fix this? If so could you help me with this?

    • @jungjungdelosreyes4147
      @jungjungdelosreyes4147 2 роки тому

      @@donnahamby1557 me too hope sir Tewan can help us. 🤗

  • @nandkishore9014
    @nandkishore9014 4 роки тому

    Excellent

  • @hamidabbasi3856
    @hamidabbasi3856 2 роки тому

    great video BUT BE CAREFUL IF YOU HAVE ANY MACRO THAT FOCUS YOU ON AN ELEMENT - that macro will not work because every second the internal focus of system is diverted per this subroutine , I have a seach m,acro that goes to a field and give you a windows for search where you can type in what you are looking for and it stopped workign until I cahnged the time interwal to 60 000 ( 1 minutes) so my macro has one minutes to look for the field

  • @29884840
    @29884840 7 років тому

    Thanks a lot sir.

  • @farinatty
    @farinatty 6 років тому

    Would using option explicit at the start of the code have caught that expiredminute vs expired minutes error??

  • @tglock19
    @tglock19 24 дні тому

    currently when I run my program and i move the mouse, it doesn't reset then time, but closes in the same amount of minutes

  • @vincenzocompagnone2636
    @vincenzocompagnone2636 4 роки тому

    Thanks

  • @osamabatrikhi5272
    @osamabatrikhi5272 4 роки тому

    Thanks indeed

  • @paul528i
    @paul528i 3 роки тому

    when run, shows error message
    The expression On Timer you entered as the event property setting produced the following error: Sub o Function not defined
    This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to =[Field], this error occurs because a macro or event name is expected to run when the event occurs.

  • @mulla916
    @mulla916 8 років тому

    yet another useful video... could you plz help me creating a module for datediff excluding only the holidays table... currently i have a module which excluded sunday an saturday which i do not want... i want to exclude only holiday table dates... thanks

    • @austin72406
      @austin72406  8 років тому

      I have another video at ua-cam.com/video/Na4kjr2EiLg/v-deo.html
      it will count only the working day that exclude the holiday and weekend. there is a code for excluding the holiday. you may modify a little bit from this video.

    • @mulla916
      @mulla916 8 років тому

      +austin72406 Thank you for your response, Unfortunately I am not good at vba... I have below code and my weekend is only Friday.. can you please help me with where I am going wrong.. I want only Fridays to be excluded,, plz helpPublic Function Weekdays(ByRef startDate As Date, _
      ByRef endDate As Date _
      ) As Integer
      ' Returns the number of weekdays in the period from startDate
      ' to endDate inclusive. Returns -1 if an error occurs.
      ' If your weekend days do not include Saturday and Sunday and
      ' do not total two per week in number, this function will
      ' require modification.
      On Error GoTo Weekdays_Error
      ' The number of weekend days per week.
      Const ncNumberOfWeekendDays As Integer = 1
      ' The number of days inclusive.
      Dim varDays As Variant
      ' The number of weekend days.
      Dim varWeekendDays As Variant
      ' Temporary storage for datetime.
      Dim dtmX As Date
      ' If the end date is earlier, swap the dates.
      If endDate < startDate Then
      dtmX = startDate
      startDate = endDate
      endDate = dtmX
      End If
      ' Calculate the number of days inclusive (+ 1 is to add back startDate).
      varDays = DateDiff(Interval:="d", _
      date1:=startDate, _
      date2:=endDate) + 1
      ' Calculate the number of weekend days.
      varWeekendDays = (DateDiff(Interval:="ww", _
      date1:=startDate, _
      date2:=endDate) _
      * ncNumberOfWeekendDays) _
      + IIf(DatePart(Interval:="w", _
      Date:=startDate) = vbFriday, 1, 0) _
      + IIf(DatePart(Interval:="w", _
      Date:=startDate) = vbThursday, 1, 0) _

      ' Calculate the number of weekdays.
      Weekdays = (varDays - varWeekendDays)
      Weekdays_Exit:
      Exit Function
      Weekdays_Error:
      Weekdays = -1
      MsgBox "Error " & Err.Number & ": " & Err.Description, _
      vbCritical, "Weekdays"
      Resume Weekdays_Exit
      End Function

    • @austin72406
      @austin72406  8 років тому

      VBA has weekday built-in function for you. you can just modify a little bit like mine:
      Public Function NewWeekdays(startDate As Date, strEndDate As Date) As Integer
      Dim intCount As Integer
      Dim strMydate As Date
      On Error GoTo errHandler
      intCount = 0
      strMydate = startDate - 1
      Do While strMydate < strEndDate
      strMydate = strMydate + 1
      If Weekday(strMydate, vbMonday) < 6 Then
      intCount = intCount + 1
      End If
      Loop
      NewWeekdays = intCount
      errHandler:
      Exit Function
      End Function
      then just call it and put the number of weekdays on the text box text6
      Me.Text6 = NewWeekdays(Me.Text1, Me.Text3)

  • @dmor3359
    @dmor3359 5 років тому

    I have successfully placed this code in my dbase. However, when I use the msg box code the dbase stays open until someone presses the OK button on the message box. Can it have another timer for the msg box to displaythe message box for only 1 minute and then close without having to click ok on the displayed message box? Initial close time is set to 20 minutes and works fine without the msgbox.

    • @tonyjohnson4351
      @tonyjohnson4351 4 роки тому

      I believe message box requires user input. Your best bet is a popup box. Add this to your code where you want to quit:
      Dim WshShell As Variant
      Dim y As Integer
      Set WshShell = CreateObject("WScript.Shell")
      y = WshShell.PopUp("The Database is going to close due to inactivity" & vbCrLf & vbCrLf & "Closing in.....", 1, "Good Bye")
      Set WshShell = Nothing

  • @abdoviper
    @abdoviper 4 роки тому

    autoexec not running when saved as accde

  • @brianklanjscek8154
    @brianklanjscek8154 5 років тому

    @Nana Sara