Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form Modification Indicator (A2K)

    I know I've done this before, but as usual, when I need it again, cannot locate it. Basically, I would like to display the date on an input screen showing when the last time the Form was modified, not the data, but the form itself. If someone would be kind enough to help me with this, I promise to add it to my ever growing collection of "code snippets" which I'm storing in TreePad. Thanks in advance,

    Andy
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Modification Indicator (A2K)

    You can put a (locked, disabled) text box on the form with control source

    =[CurrentProject].[AllForms]("frmMyForm").[DateModified]

    where frmMyForm is the name of the form; set the format of the text box to the date/time format you like. Or you can set the caption of a label in the On Load event of the form:

    Me.lblModified.Caption = Format(CurrentProject.AllForms(Me.Name).DateModifi ed, "mm/dd/yyyy hh:mm")

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Modification Indicator (A2K)

    Hans,

    Thanks kindly for your quick response. I created a text box, with =[CurrentProject].[AllForms]("frm DPM Projects").[DateModified] as Data Source, locked it, disabled it and got the old #Error when I saved it. Where did I go wrong?
    Cheers,
    Andy

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Modification Indicator (A2K)

    CurrentProject and AllForms were introduced in Access 2000, so unless there is a typo in the name of the form, it should work.

    Have you tried the other method I suggested (setting the caption of a label in the On Load event)?

  5. #5
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Modification Indicator (A2K)

    Hans,

    If at first you don
    Cheers,
    Andy

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Modification Indicator (A2K)

    I tested on Access 2002; it works there. I don't have Access 2000, so I can't test it there, or tell you why it doesn't work for you. Anyone else?

    Meanwhile, here is a different method using DAO. DAO has been available in Access for much longer than AllForms etc, so it should work. <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

    We use the lblModified label and put code in the On Load event:

    Dim dbs As DAO.Database
    Dim ctr As DAO.Container
    Dim doc As DAO.Document

    Set dbs = CurrentDb
    Set ctr = dbs.Containers("Forms")
    Set doc = ctr.Documents(Me.Name)

    Me.lblModified.Caption = doc.Properties("LastUpdated")

    Set doc = Nothing
    Set ctr = Nothing
    Set dbs = Nothing

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Modification Indicator (A2K)

    Hi Hans

    Is this date dyanmic?

    When you do a Compact & Repair is the date changed, so you loose the actual date the form was changed?

    John

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Modification Indicator (A2K)

    John,

    If you use this code in the On Load event of a form, the LastUpdated property will be read each time the form is opened.

    A compact and repair doesn't modify the design of database objects, so the Last Updated date/time won't be changed. Compiling the code in a database (Debug | Compile <project> in the Visual Basic Editor) will change the Last Updated date/time for all forms, reports and modules affected by the compilation.

  9. #9
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Modification Indicator (A2K)

    Interestinger and interestinger. OK, cut and pasted your exact code into the lblModified label and got back a date from August of this year which meant absolutely nothing to me. So, I made a programmatical change to the form by adding a new field, therefore MODIFYING the form. Saved and exited and came back in and lo and behold, it still shows the August date. I may be losing something in the translation. I had expected to see the date and time when I'd made this change and nothing happened. Oh, well.... I appreciate your help but feel free to drop this little quirk until I possibly find another answer. I hate to take up your valuable time,

    Andy
    Cheers,
    Andy

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Modification Indicator (A2K)

    The LastUpdated property returns the date/time the form was created! It's a bug, see ACC2000: DAO LastUpdated Property Returns Incorrect Date/Time. I didn't notice at first because the dates were equal for the form I tested on, but now I see that it doesn't work. According to the MSKB article, the modification date can't be retrieved any more using DAO in Access 2000 and up. Sorry!

    It's a pity that the methods I suggested originally don't work for you, for they do return the correct modification date on my form. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

  11. #11
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form Modification Indicator (A2K)

    Hans,

    Thanks again for your gallant efforts. I'm way too tired tonight to flog this thing any longer. Will give another try over the weekend.

    Andy
    Cheers,
    Andy

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Form Modification Indicator (A2K)

    Access 2000 doesn't recognize the syntax, Hans. It works in 2002 but not 2000. DateModified and DateCreated weren't exposed properties in 2000 and DateModifed, DateCreated and CurrentView weren't available as dropdown properties at all in 2000, although you could get to CurrentView directly through Forms("myform").CurrentView.
    Charlotte

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form Modification Indicator (A2K)

    Thanks for testing on Access 2000, Charlotte. So the DAO method doesn't work any more in Access 2000, and the DateModified property isn't available yet. Do you have any idea how to get at the modified date of a form then?

  14. #14
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Form Modification Indicator (A2K)

    My <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15> - Since Access 2000 we don't find the date modified to be of significant value, as every time you compile the database all forms and reports (unless they don't have a module) get the current date, even if nothing changed.
    Wendell

  15. #15
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Form Modification Indicator (A2K)

    I don't know of any, but then I don't allow users to change object design and I use SourceSafe to track my changes. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •