Access 2007 at Odds with Vista

D

DudgeonousTweet

Open Access 2007 and save the blank database to the desktop. Rename it
mydatabase.accdb, and open it again and add one blank form, rename it
FirstStart. Go to the Visual Basic Editor and add the code:

Private Sub Form_Open(Cancel As Integer)
Application.Quit
End Sub

to the Microsoft Office Class Object Form_FirstStart.

Then go to Access Options and set up the program to display the form
FirstStart when the database is opened. Then exit Access and observe this
behavior:

When the icon for this accdb file is "double clicked", Vista throws the
"Windows cannot find this file..." error. When the icon for this accdb file
is right clicked and "Open" is selected, Vista again throws the "Windows
cannot find this file ..." error. When the icon for this accdb file is right
clicked and "Open With" is selected, and then Access 2007 is selected, the
file opens in Access and closes normally.

No amount of sleeping before or after the Quit has any influence on the
behavior. However, this code:

Private Sub Form_Open(Cancel As Integer)
MsgBox "Stop"
Application.Quit
End Sub

will open the file normally, throw up the MsgBox with the "Stop" string, and
will close normally when "OK" is selected.

This worked on Access 2003 on Windows XP.

This is rock solid reproducible (on my Lenovo T400). It fails the same way
when Vista comes up in a "clean boot".

This fails the same way when Access 2007 is operating on an mdb file in Vista.

Is this a known bug? If so could someone please direct me to the discussion
of this?

There is a lot of chatter on the web about this error. There is software
that can be downloaded. There are registry hacks. There are software
re-registrations. There are other things. If this is a bug, would someone
please say so. It may reduce the pressure on people to believe in a
misdiagnosis and do bad things to their systems.

Thank you.
 
D

DudgeonousTweet

Dear Mr. Vandal,

Thank you for your consideration of my problem.

I have Vista Home Basic SP 2 and Access2007 SP2.

Yes, I omitted the piece on the trusted location. Let me amend my recipe to
include that:

Open Access 2007 and save the blank database to the trusted directory
location. Rename it mydatabase.accdb. Open the file again and add one blank
form, rename it FirstStart. Go to the Visual Basic Editor and add the code:

Private Sub Form_Open(Cancel As Integer)
Application.Quit
End Sub

to the Microsoft Office Class Object Form_FirstStart.

Then go to Access Options and set up the program to display the form
FirstStart when the database is opened. Then exit Access and observe this
behavior:

When the icon for this accdb file is "double clicked", Vista throws the
"Windows cannot find this file..." error. When the icon for this accdb file
is right clicked and "Open" is selected, Vista again throws the "Windows
cannot find this file ..." error. When the icon for this accdb file is right
clicked and "Open With" is selected, and then Access 2007 is selected, the
file opens in Access and closes normally.

No amount of sleeping before or after the Quit has any influence on the
behavior. However, this code:

Private Sub Form_Open(Cancel As Integer)
MsgBox "Stop"
Application.Quit
End Sub

will open the file normally, throw up the MsgBox with the "Stop" string, and
will close normally when "OK" is selected.

This us of Application.Quit worked on Access 2003 on Windows XP.

This is rock solid reproducible (on my Lenovo T400). It fails the same way
when Vista comes up in a "clean boot".

This fails the same way when Access 2007 is operating on an mdb file in Vista.

In the above recipe I save the database to the trusted directory so that the
Desktop is completely out of the loop.

If there is an issue with the trusted directory being, or not being, the
"owner" of the database file, this is new to me. I don't know about a
directory "owning" something. If this is a possible issue could you direct
me to a site that would explain how I tell what directory is the "owner" of a
given file.

Yes, the system does have 2 Gb of RAM.

I put a 1 second sleep in before and after the Quit. It fails the same way.

The problem is very reliable on my system.

Thank you.
 
D

DudgeonousTweet

Dear Mr. Vandal,

Yes. Excellent. Thank you.

Your suggestion worked. Early on I had been suspicious that there was a
race condition between the Quit and the launch of Access, but my attempts to
confirm that failed because I used this structure to slow down the Quit:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Open(Cancel As Integer)
Sleep 1000
Application.Quit
End Sub

This did not cure the problem for any value on the sleep. In retrospect it
appears that this sleep slows down all threads related to the Access launch
and so it does not cause the launch thread to get finished before the Quit
thread starts.

I was unaware that the form had a timer before your suggestion. At your
suggestion I found the form timer in Help and substituted this structure for
the above:

Private Sub Form_Load()
Me.TimerInterval = 200
End Sub

Private Sub Form_Timer()
Application.Quit
End Sub

This works like a champ.

Since the original structure worked for Access 2003 running over XP it seems
that Access 2007 is faster than Access 2003, or Vista is slower than XP, or
both.

Or I suppose it might be that while Access 2003 and XP waited politely for
Access to be completely loaded before starting the Form_Open event handler
thread, Access 2007 and Vista are not as polite and go ahead and launch
Form_Open before Access is fully loaded.

Or something else.

My application now works. Thank you for your help.
 
D

DudgeonousTweet

Dear Mr. Vandal,

Yes. Excellent. Thank you.

Your suggestion worked. Early on I had been suspicious that there was a
race condition between the Quit and the launch of Access, but my attempts to
confirm that failed because I used this structure to slow down the Quit:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Open(Cancel As Integer)
Sleep 1000
Application.Quit
End Sub

This did not cure the problem for any value on the sleep. In retrospect it
appears that this sleep slows down all threads related to the Access launch
and so it does not cause the launch thread to get finished before the Quit
thread starts.

I was unaware that the form had a timer before your suggestion. At your
suggestion I found the form timer in Help and substituted this structure for
the above:

Private Sub Form_Load()
Me.TimerInterval = 200
End Sub

Private Sub Form_Timer()
Application.Quit
End Sub

This works like a champ.

Since the original structure worked for Access 2003 running over XP it seems
that Access 2007 is faster than Access 2003, or Vista is slower than XP, or
both.

Or I suppose it might be that while Access 2003 and XP waited politely for
Access to be completely loaded before starting the Form_Open event handler
thread, Access 2007 and Vista are not as polite and go ahead and launch
Form_Open before Access is fully loaded.

Or something else.

My application now works. Thank you for your help.
 

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