Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Returning the last modified date of an object in Access 2002 and 2003

Discussion in 'Information Technology' started by Paul Ponzelli, Jul 28, 2006.

  1. Paul Ponzelli

    Paul Ponzelli
    Expand Collapse
    Guest

    In VBA, docCurrObject.LastUpdated is supposed to return the modified date of
    an object. However, it does not work in MSA 2000 and above. It usually
    returns the create date of the object and not the modified date. This was a
    known bug in Access 2000 (http://support.microsoft.com/kb/299554/en-us).
    Several years ago, I received a solution to this problem from MS; however, I
    cannot find it. Is there a solution for this in MSA 2002 and 2003?

    Thanks in advance.

    Paul
     
  2. Loading...

    Similar Threads Forum Date
    Christianity The Path of Returning to God Interfaith Dialogues Feb 6, 2011
    Returning to SPN Announcements Nov 2, 2006
    Returning to sikhi, actually... Announcements Feb 14, 2006
    Christianity will religions join with the returning of Jesus? Interfaith Dialogues Jun 28, 2005
    Last Blog Blogs Oct 14, 2016

  3. Wayne-I-M

    Wayne-I-M
    Expand Collapse
    Guest

    RE: Returning the last modified date of an object in Access 2002 and 2

    Use DateModifield = Date()


    Something like this on form afterupdate or beforeupdate


    Private Sub NameOfForm_BeforeUpdate(Cancel As Integer)
    On Error GoTo BeforeUpdate_Err

    DateModified = Date

    BeforeUpdate_End:
    Exit Sub



    Hope this helps

    --
    Wayne




    "Paul Ponzelli" wrote:

    > In VBA, docCurrObject.LastUpdated is supposed to return the modified date of
    > an object. However, it does not work in MSA 2000 and above. It usually
    > returns the create date of the object and not the modified date. This was a
    > known bug in Access 2000 (http://support.microsoft.com/kb/299554/en-us).
    > Several years ago, I received a solution to this problem from MS; however, I
    > cannot find it. Is there a solution for this in MSA 2002 and 2003?
    >
    > Thanks in advance.
    >
    > Paul
    >
    >
    >
     
  4. Paul Ponzelli

    Paul Ponzelli
    Expand Collapse
    Guest

    Re: Returning the last modified date of an object in Access 2002 and 2

    Thanks for the reply, Wayne, but I am actually looking for the modified date
    of the object itself (example when the design of a form, report was last
    modified). I may not have been very clear in my initial post so here is
    some more information. If you look at the objects (Tables, Forms, Reports,
    etc) in the Access database window you will see the object name,
    description, the date last modified, and the date the object was created.
    The modify date shows the date the object was last modified. This
    information is available in VB using objectname.LastUpdated; however, in MSA
    2000, 2002, 2003, there is a bug. Here is some sample code. You will
    notice the objectname.LastUpdated is surrounded by ****. If you copy this
    code into a db, modify one of your forms and run the code, you will see that
    ObjectName.LastUpdated incorrectly returns the Create Date and not the
    modified date. The bug is described in the MS link above, but only
    references MSA 2000. Any help would be appreciated.

    Option Compare Database
    Option Explicit

    Public dblocal As Database
    Public dbactive As Database
    Public dynactive As Recordset
    Public strMasterdb As String
    Public strTargetdb As String
    Public varReturn As Variant
    Public intMeterCounter As Long

    Sub GetObjects()
    ' Routine to Get objects and tables from both the Master Db and the Target
    db
    ' Loops thru and loads object information into tables

    Dim dbactive As Database ' var representing active db (master or target)
    Dim cntObjects As Container 'Var Container for Master db and Target db
    Dim docCurrObject As Document ' Var Document for Master db and Target db
    Dim ObjType As String ' var to hold object type
    Dim i As Integer 'counter to loop thru Object types
    Dim dynactive As Recordset 'Var holding Object Names for Master and Target
    Dim j As Integer ' counter to loop thru Master and Target

    Set dblocal = CurrentDb ' Set dblocal = this db

    j = 0
    i = 0

    '***** Get Objects - Forms, Modules, and Reports for Master and Target
    ******

    'If Forms!frmMain!grpSelectCriteria <> 5 Then 'check for tbl only options

    'Loop twice to process master first then Target second
    For j = 1 To 2
    ' Select between target and Master dbs and dyn.
    Select Case j
    Case 1 ' Set var to Master and loop
    strMasterdb = "C:\Test\EditDateProblem"
    Set dbactive = OpenDatabase(strMasterdb)
    Set dynactive = dblocal.OpenRecordset("tbl_Master_Objects")
    If Forms!frmMain!grpSelectCriteria = 6 Then
    j = 3
    End If
    Case 2 'Set var to Target and loop
    'Set dbactive = OpenDatabase(strTargetdb)
    'Set dynactive = dblocal.OpenRecordset("tbl_Target_Objects")
    End Select

    'Loop and capture Forms, Reports, Modules
    For i = 1 To 3
    Select Case i
    Case 1
    ObjType = "Forms"
    Case 2 '
    ObjType = "Reports"
    Case 3
    ObjType = "Modules"
    End Select

    'set cntObjects = to master/target db forms/reports/modules
    container
    Set cntObjects = dbactive.Containers(ObjType)

    'Setup Progress Meter
    varReturn = SysCmd(acSysCmdInitMeter, "Analyzing " & ObjType,
    cntObjects.Documents.Count)
    intMeterCounter = 0

    ' Loop thru objects in container and write data to table
    For Each docCurrObject In cntObjects.Documents
    intMeterCounter = intMeterCounter + 1
    varReturn = SysCmd(acSysCmdUpdateMeter, intMeterCounter)
    dynactive.AddNew
    dynactive!ObjName = docCurrObject.Name

    '*****************************
    dynactive!objLastModDate = docCurrObject.LastUpdated

    '*****************************
    dynactive!ObjType = ObjType
    dynactive.Update
    Next docCurrObject
    Next i
    Next j
    'End If

    'dynactive.Close
    varReturn = SysCmd(acSysCmdRemoveMeter) ' Close Progress Meter

    'Close out all Variables
    Set docCurrObject = Nothing
    Set cntObjects = Nothing
    j = 0
    i = 0
    intMeterCounter = 0

    On Error Resume Next
    dbactive.Close
    dynactive.Close

    End Sub


    Hope this helps.

    Paul
     
  5. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    Re: Returning the last modified date of an object in Access 2002 and 2

    the table MSYSOBJECTS has always stored the correct info

    HTH

    Pieter

    SELECT NAME, DATECREATE, DATEUPDATE FROM MSYSOBJECTS



    "Paul Ponzelli" <pponzelli_delete_this_@dfi.ca.gov> wrote in message
    news:OeNrqxdfGHA.408@TK2MSFTNGP04.phx.gbl...
    > Thanks for the reply, Wayne, but I am actually looking for the modified
    > date of the object itself (example when the design of a form, report was
    > last modified). I may not have been very clear in my initial post so here
    > is some more information. If you look at the objects (Tables, Forms,
    > Reports, etc) in the Access database window you will see the object name,
    > description, the date last modified, and the date the object was created.
    > The modify date shows the date the object was last modified. This
    > information is available in VB using objectname.LastUpdated; however, in
    > MSA 2000, 2002, 2003, there is a bug. Here is some sample code. You will
    > notice the objectname.LastUpdated is surrounded by ****. If you copy this
    > code into a db, modify one of your forms and run the code, you will see
    > that ObjectName.LastUpdated incorrectly returns the Create Date and not
    > the modified date. The bug is described in the MS link above, but only
    > references MSA 2000. Any help would be appreciated.
    >
    > Option Compare Database
    > Option Explicit
    >
    > Public dblocal As Database
    > Public dbactive As Database
    > Public dynactive As Recordset
    > Public strMasterdb As String
    > Public strTargetdb As String
    > Public varReturn As Variant
    > Public intMeterCounter As Long
    >
    > Sub GetObjects()
    > ' Routine to Get objects and tables from both the Master Db and the Target
    > db
    > ' Loops thru and loads object information into tables
    >
    > Dim dbactive As Database ' var representing active db (master or target)
    > Dim cntObjects As Container 'Var Container for Master db and Target db
    > Dim docCurrObject As Document ' Var Document for Master db and Target db
    > Dim ObjType As String ' var to hold object type
    > Dim i As Integer 'counter to loop thru Object types
    > Dim dynactive As Recordset 'Var holding Object Names for Master and Target
    > Dim j As Integer ' counter to loop thru Master and Target
    >
    > Set dblocal = CurrentDb ' Set dblocal = this db
    >
    > j = 0
    > i = 0
    >
    > '***** Get Objects - Forms, Modules, and Reports for Master and Target
    > ******
    >
    > 'If Forms!frmMain!grpSelectCriteria <> 5 Then 'check for tbl only options
    >
    > 'Loop twice to process master first then Target second
    > For j = 1 To 2
    > ' Select between target and Master dbs and dyn.
    > Select Case j
    > Case 1 ' Set var to Master and loop
    > strMasterdb = "C:\Test\EditDateProblem"
    > Set dbactive = OpenDatabase(strMasterdb)
    > Set dynactive = dblocal.OpenRecordset("tbl_Master_Objects")
    > If Forms!frmMain!grpSelectCriteria = 6 Then
    > j = 3
    > End If
    > Case 2 'Set var to Target and loop
    > 'Set dbactive = OpenDatabase(strTargetdb)
    > 'Set dynactive =
    > dblocal.OpenRecordset("tbl_Target_Objects")
    > End Select
    >
    > 'Loop and capture Forms, Reports, Modules
    > For i = 1 To 3
    > Select Case i
    > Case 1
    > ObjType = "Forms"
    > Case 2 '
    > ObjType = "Reports"
    > Case 3
    > ObjType = "Modules"
    > End Select
    >
    > 'set cntObjects = to master/target db forms/reports/modules
    > container
    > Set cntObjects = dbactive.Containers(ObjType)
    >
    > 'Setup Progress Meter
    > varReturn = SysCmd(acSysCmdInitMeter, "Analyzing " & ObjType,
    > cntObjects.Documents.Count)
    > intMeterCounter = 0
    >
    > ' Loop thru objects in container and write data to table
    > For Each docCurrObject In cntObjects.Documents
    > intMeterCounter = intMeterCounter + 1
    > varReturn = SysCmd(acSysCmdUpdateMeter, intMeterCounter)
    > dynactive.AddNew
    > dynactive!ObjName = docCurrObject.Name
    >
    > '*****************************
    > dynactive!objLastModDate = docCurrObject.LastUpdated
    >
    > '*****************************
    > dynactive!ObjType = ObjType
    > dynactive.Update
    > Next docCurrObject
    > Next i
    > Next j
    > 'End If
    >
    > 'dynactive.Close
    > varReturn = SysCmd(acSysCmdRemoveMeter) ' Close Progress Meter
    >
    > 'Close out all Variables
    > Set docCurrObject = Nothing
    > Set cntObjects = Nothing
    > j = 0
    > i = 0
    > intMeterCounter = 0
    >
    > On Error Resume Next
    > dbactive.Close
    > dynactive.Close
    >
    > End Sub
    >
    >
    > Hope this helps.
    >
    > Paul
    >
     
  6. Paul Ponzelli

    Paul Ponzelli
    Expand Collapse
    Guest

    Re: Returning the last modified date of an object in Access 2002 and 2

    Good suggestion, Pieter. It works!

    Thank you.


    "Pieter Wijnen" <wijnen.nospam.please@online.no> wrote in message
    news:uzcSpuffGHA.2456@TK2MSFTNGP04.phx.gbl...
    > the table MSYSOBJECTS has always stored the correct info
    >
    > HTH
    >
    > Pieter
    >
    > SELECT NAME, DATECREATE, DATEUPDATE FROM MSYSOBJECTS
    >
    >
    >
    > "Paul Ponzelli" <pponzelli_delete_this_@dfi.ca.gov> wrote in message
    > news:OeNrqxdfGHA.408@TK2MSFTNGP04.phx.gbl...
    >> Thanks for the reply, Wayne, but I am actually looking for the modified
    >> date of the object itself (example when the design of a form, report was
    >> last modified). I may not have been very clear in my initial post so
    >> here is some more information. If you look at the objects (Tables,
    >> Forms, Reports, etc) in the Access database window you will see the
    >> object name, description, the date last modified, and the date the object
    >> was created. The modify date shows the date the object was last modified.
    >> This information is available in VB using objectname.LastUpdated;
    >> however, in MSA 2000, 2002, 2003, there is a bug. Here is some sample
    >> code. You will notice the objectname.LastUpdated is surrounded by ****.
    >> If you copy this code into a db, modify one of your forms and run the
    >> code, you will see that ObjectName.LastUpdated incorrectly returns the
    >> Create Date and not the modified date. The bug is described in the MS
    >> link above, but only references MSA 2000. Any help would be appreciated.
    >>
    >> Option Compare Database
    >> Option Explicit
    >>
    >> Public dblocal As Database
    >> Public dbactive As Database
    >> Public dynactive As Recordset
    >> Public strMasterdb As String
    >> Public strTargetdb As String
    >> Public varReturn As Variant
    >> Public intMeterCounter As Long
    >>
    >> Sub GetObjects()
    >> ' Routine to Get objects and tables from both the Master Db and the
    >> Target db
    >> ' Loops thru and loads object information into tables
    >>
    >> Dim dbactive As Database ' var representing active db (master or target)
    >> Dim cntObjects As Container 'Var Container for Master db and Target db
    >> Dim docCurrObject As Document ' Var Document for Master db and Target db
    >> Dim ObjType As String ' var to hold object type
    >> Dim i As Integer 'counter to loop thru Object types
    >> Dim dynactive As Recordset 'Var holding Object Names for Master and
    >> Target
    >> Dim j As Integer ' counter to loop thru Master and Target
    >>
    >> Set dblocal = CurrentDb ' Set dblocal = this db
    >>
    >> j = 0
    >> i = 0
    >>
    >> '***** Get Objects - Forms, Modules, and Reports for Master and Target
    >> ******
    >>
    >> 'If Forms!frmMain!grpSelectCriteria <> 5 Then 'check for tbl only options
    >>
    >> 'Loop twice to process master first then Target second
    >> For j = 1 To 2
    >> ' Select between target and Master dbs and dyn.
    >> Select Case j
    >> Case 1 ' Set var to Master and loop
    >> strMasterdb = "C:\Test\EditDateProblem"
    >> Set dbactive = OpenDatabase(strMasterdb)
    >> Set dynactive =
    >> dblocal.OpenRecordset("tbl_Master_Objects")
    >> If Forms!frmMain!grpSelectCriteria = 6 Then
    >> j = 3
    >> End If
    >> Case 2 'Set var to Target and loop
    >> 'Set dbactive = OpenDatabase(strTargetdb)
    >> 'Set dynactive =
    >> dblocal.OpenRecordset("tbl_Target_Objects")
    >> End Select
    >>
    >> 'Loop and capture Forms, Reports, Modules
    >> For i = 1 To 3
    >> Select Case i
    >> Case 1
    >> ObjType = "Forms"
    >> Case 2 '
    >> ObjType = "Reports"
    >> Case 3
    >> ObjType = "Modules"
    >> End Select
    >>
    >> 'set cntObjects = to master/target db forms/reports/modules
    >> container
    >> Set cntObjects = dbactive.Containers(ObjType)
    >>
    >> 'Setup Progress Meter
    >> varReturn = SysCmd(acSysCmdInitMeter, "Analyzing " & ObjType,
    >> cntObjects.Documents.Count)
    >> intMeterCounter = 0
    >>
    >> ' Loop thru objects in container and write data to table
    >> For Each docCurrObject In cntObjects.Documents
    >> intMeterCounter = intMeterCounter + 1
    >> varReturn = SysCmd(acSysCmdUpdateMeter, intMeterCounter)
    >> dynactive.AddNew
    >> dynactive!ObjName = docCurrObject.Name
    >>
    >> '*****************************
    >> dynactive!objLastModDate = docCurrObject.LastUpdated
    >>
    >> '*****************************
    >> dynactive!ObjType = ObjType
    >> dynactive.Update
    >> Next docCurrObject
    >> Next i
    >> Next j
    >> 'End If
    >>
    >> 'dynactive.Close
    >> varReturn = SysCmd(acSysCmdRemoveMeter) ' Close Progress Meter
    >>
    >> 'Close out all Variables
    >> Set docCurrObject = Nothing
    >> Set cntObjects = Nothing
    >> j = 0
    >> i = 0
    >> intMeterCounter = 0
    >>
    >> On Error Resume Next
    >> dbactive.Close
    >> dynactive.Close
    >>
    >> End Sub
    >>
    >>
    >> Hope this helps.
    >>
    >> Paul
    >>

    >
    >
     

Share This Page