Does Anyone understand this code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kepbem
    New Member
    • Apr 2010
    • 1

    #1

    Does Anyone understand this code?

    I am new to this forum, i have created this database, however the timetables will not reset themselves. They have done previously, can anyone help?


    Code:
    Option Compare Database
    Option Explicit
    
    '------------------------------------------------------------
    ' Macro1
    '
    '------------------------------------------------------------
    Function Macro1()
    On Error GoTo Macro1_Err
    Dim db As DAO.Database, rstdatechange As Recordset
    
    Set db = CurrentDb()
    Set rstdatechange = db.OpenRecordset("datechange")
    
    On Error GoTo Macro1_Err
       
            If (rstdatechange![last updated] < Date) Or ((rstdatechange![last updated] = Date) And (Time >= rstdatechange![last time])) Then
            DoCmd.RunMacro "Create History", , ""
            DoCmd.RunMacro "Delete Timetables", ""
            DoCmd.RunMacro "Recreate Timetables", , ""
            DoCmd.OpenQuery "change update date", acNormal, acEdit
            DoCmd.Close acQuery, "change update date"
            End If
     
        
    
    Macro1_Exit:
        Exit Function
    
    Macro1_Err:
        MsgBox Error
        Resume Macro1_Exit
    
    End Function
Working...