VBA problem with LastUpdated property

G

Guest

in an old application (version 97) i created a routine to do updates of
database objects to the users versions when I make updates to the
application. I post an Update.mdb file to a server location and each time a
user loads the application it check to see if there is a new version of the
database. If there is it then checked the LastUpdate property of every
object to determine which objects are new and copies them to the users
version to update it.

The Problem: In converting the application to 2003 this process is failing.
The application does not crash, but runs past the routine. After
troubleshooting the problem I have found that even though I'm checking the
lastUpdated property of the object the dateCreated date is passed. Regardless
of when i make the change it is the DateCreated that is passed. From the
database window...the Detail view of the object shows the date Modified as
being correct.

Example: I create a Form on 01/01/2006 both Date created and DateModified
show this date. If I modify the form on 02/02/2006. Date Created shows
01/01/2006 Date Modified is 02/02/2006. However when I pull the
LastModified Property it is 01/01/2006.

Here is the code I use for Forms or Reports:
dbUD.Containers("Reports").Documents(x).LastUpdated
dbUD.Containers("Forms").Documents(x).LastUpdated

I really need some Help!!!!!!
 
A

Allen Browne

You are correct. Microsoft broke this functionality in Access 2000.

It seems to have to do with the fact that Access 2000 and later does a
monolithic save. You used to be able to save one object, but now it just
rewrites the whole file. They fixed the visuals shown in the Database
window, but they did not fix the dates stored in MSysObjects (which is where
the Containers read the date from.)

We have this listed as issue #6 under Usability in:
Converting from Access 97
at:
http://allenbrowne.com/ser-48.html
but I don't have a solution for you.

Depending on what you need to accomplish, the FE Updater utility by Tony
Toews might be useful:
http://www.granite.ab.ca/access/autofe.htm
 
G

Guest

Thanks Allen.

Thanks for the info.... couple of questions
Is this an issue that will be changed?
where is the data stored that is displayed in the database window, and is it
accessable?

Thanks
Mike
 
A

Allen Browne

I see no chance of this issue being fixed for existing versions of Access,
and I don't know how to get at the information you need. It's clearly there
(shown in the database window as you say), but it's not exposed to use
AFAIK. If anyone else knows how to get it, we would love to hear from you.

Up to Access 97, MSysObjects was the canonical collection. In Access 2000,
Microsoft cobbled Access together with the Visual Basic IDE. In doing so,
they destroyed some important functionality. For example, you can no longer
compile just the module you are working on: you must compile the whole
project, and saving any one object has the side effect of popping up a
dialog where you must make choices about every other object that is unsaved.
I find that really annoying. (The Access 2007 beta is worse: it pops up the
dialog even if there are no other objects to save, and the dialog hides
behind the help window if you have that open, so it just behaves like it's
stuck.)

In the process, they decided for some reason that they needed another copy
of all the objects (presumably for the VBA IDE.) So, starting with Access
2000, there is now another collection of objects, exposed as the AllForms
collection of the CurrentProject, the AllTables collection of CurrentData,
etc. These are, in fact, another completely different set of objects than
those in MSysObjects. In other words, Access now has two different listing
of the objects that it has to manage.

As anyone who works with relational databases knows, that's an absolute
no-no. As soon as you are maintaining 2 lists, you have the possibility that
they get out of sync., so the data becomes rubbish. It happens. There are
cases where something goes wrong, and the list of objects shown in the
database window no longer matches the list in MSysObjects.

From this experience, I can tell you that the Database window in Access 2000
and later displays the contents of the collections AllForms, AllTables, etc,
and not the contents of MSysObjects. So the Documents in the DAO Containers
(as in your code) still relies on MSysObjects as it always has, but what is
shown in the database window is completely different.

AFAIK, there is no way to get at the dates of the objects that are shown in
the database window. They don't seem to be exposed as properties of the
AccessObject in the AllXXX collections.

That doesn't solve your problem, but I hope it helps with understanding
what's going on.
 
G

Guest

Yes it does. Thanks for the time on this... all I can think is "What are
they thinking there"... I think I may have a way around this problem, but
its just more work for me (unpaid work no less). Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top