Results 1 to 5 of 5
  1. #1
    jlindquist23 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2019
    Posts
    19

    Open Form Based on a Timer

    My operators have a database they work in and have it open 24-7.
    At 6:40 AM every day, I'd like a form with a formatted message to open.


    The form name is 3rdShiftMessage
    I've attached the form. I know you can use a message box also, but I'm not sure if the formatting would look ok?
    Attached Thumbnails Attached Thumbnails MsgForm.JPG  

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,892
    tblEvents
    [EventTime], [Reminder]
    6:40, 3rdShiftMessage

    the main form has a timer, interval set to 30000. (30 seconds)
    iin the ON TIMER property, it would open the form:

    if this the only event, then you don't need the table above.
    if there are many events, then the timer would check the tbl for the event to show

    Code:
    sub Form_Timer()
    dim vTargTime as time
    
    vTargTime = #6:40 am#
    vTargForm = "3rdShiftMessage"
    
    if format(now(),"hh:nn ampm") = vTargTime then  docmd.openform vTargForm
      
    end sub
    


  3. #3
    isladogs's Avatar
    isladogs is offline Very idle programmer
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    3,989
    Ranman's suggestion will work fine providing you have a 'main' form that is permanently open.

    If that's not the case, create a new form frmCheck with a timer event as described.
    Then add code to either an autoexec macro or your startup form to open frmCheck hidden and then leave it running in the background
    Colin (Mendip Data Systems) : Website, email
    If this has helped, please click the star button and leave a comment

  4. #4
    jlindquist23 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2019
    Posts
    19
    that code gave me the error: Compile error: User-defined type not defined.
    and highlighted "vTargTime as time"

  5. #5
    isladogs's Avatar
    isladogs is offline Very idle programmer
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    3,989
    It should be:
    Code:
    Dim vTargTime as Date
    Dim vTargForm as String
    Colin (Mendip Data Systems) : Website, email
    If this has helped, please click the star button and leave a comment

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

Similar Threads

  1. Form Timer emails
    By DMT Dave in forum Access
    Replies: 2
    Last Post: 05-30-2019, 08:00 AM
  2. Replies: 47
    Last Post: 07-12-2017, 08:51 AM
  3. Combo box based timer
    By revival786 in forum Access
    Replies: 8
    Last Post: 05-12-2014, 11:41 PM
  4. Replies: 10
    Last Post: 10-14-2013, 10:18 AM
  5. Replies: 2
    Last Post: 04-01-2013, 04:23 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
  •  
Tech Forums: Microsoft Office Forums