Question Problem Opening MS Access 2007

Joined
Nov 23, 2014
Messages
17
Location
Richardson, TX
Programming Experience
10+
I have a fully operational VB.NET program (called prjPathfinder) that uses MS Office XP Professional and its related Access database. Because of security concerns, I recently upgraded from Office XP Professional to Office 2007 Professional and Access 2007. I can tell Access 2007 is working because I can launch it from the shortcut on the desktop and run database queries. When I try to open Access 2007 from prjPathfinder, I get "Error 5: The type initializer for prjPathfinder.Upgrade Support threw an exception.", then it displays the first form in prjPathfinder without opening Access 2007.

Apparently there is a difference or differences in the requirements for opening Access 2007. What am I missing?

The database reflects the amateur packet radio node network of North America. prjPathfinder takes the GPS coordinates of the specified starting node, and the GPS coordinates of the specified destination node, and recursively finds its a viable path between the two nodes if a viable path exists. It uses an Excel object model to display the path in real time as it is finding it. The Office XP version works great. Except for upgrading the version of MS Office, there have been no other changes.

I have posted a very similar question on the Access forum, and they recommended I post one here as well.
 
Assuming that you have the appropriate Office object library reference, there are really only two possibilities:

1. You don't have the appropriate namespace import(s) to be able to refer to that type in that way.
2. That type does not exist in the newer version of Excel.

You can use the Object Browser to determine whether the first possibility is true or not. If it is true then you simply change your namespace import(s) appropriately and you're good to go. If it's not true then number 2 must be the case, which means that you need to determine what role that type played in your app and what type plays that role in the newer Excel version and then change your code appropriately to use the new type.
 
Maybe I'm not bright enough to determine whether the first possibility is true or not. I typed "Excel.Global is not defined" into the Bing search engine. About the third response down from the top is almost my situation verbatim. The answer to his question was, "try Imports Excel=Microsoft.Office.Interop.Excel". I tried that, and now I get two errors, "Excel.Global is not defined" and "Imports Alias 'Excel' conflicts with 'Namespace Excel' declared in the root namespace".

The variable name that caused the error in the first place, "ExcelGlobal", does not appear in my source code at all; it must be somewhere in code generated by Visual Basic. I'm puzzled as to how to get rid of it. "ExcelGlobal_definst. . ." that appears in the UpGradeSupport module is the only instance visible.
 
This part worries me:
Imports Alias 'Excel' conflicts with 'Namespace Excel' declared in the root namespace
What is the root namespace for your project? It can be found in the project properties.
 
I can get rid of the "Imports Alias 'Excel' conflicts with 'Namespace Excel' declared in the root namespace" error by changing "Imports Excel..." to "Imports ImportedExcel...", but that still leaves me with the original "Excel.Global is not defined" error, and I still have not found any way to define Excel.Global without it responding with "end of statement expected". Certainly others have experienced this problem, and certainly there must be a solution, although the other instances I have seen do not involve MS Office 2007.
 
Rather than "Excel.Global is not defined", the actual error was, "Type Excel.Global is not defined". Sorry if I misled anyone with that omission. The variable name, Excel.Global, suggests a structure, in which Global is a member of Excel. However, I believe Global is a property; not a type. In the UpgradeSupport module, it reads, "...As New Excel.[Global]". According to the textbook, Visual Basic.NET, by Diane Zak, items enclosed in square brackets are optional. I submit that Excel.[Global] and Excel.Global are not equivalent expressions, and that the error is the result of a bug in Visual Basic.NET. No instance of Type Excel.Global exists in the program, requiring definition. However, simply commenting out that line of code in the UpgradeSupport module does not solve the problem, because I still cannot open the database. That is what I did before I started this thread in the first place.
 
Today is 1-2-2015. Several entries between 12-22-2014 and today have disappeared. The problem is still not resolved. The actual error message was "Type Excel.Global is not defined." The variable name Excel.Global suggests a structure, where Global is a member of Excel. The original line of code in the UpgradeSupport module refers to "Excel.[Global]". I believe Global is a property; not a type. I submit that Excel.[Global] and Excel.Global are not equivalent expressions. In the textbook, Visual Basic.NET, by Diane Zak, it says items enclosed within square brackets are optional. Although I question the existence of an instance of "Type Excel.Global", somehow I need to get rid of that error message before I can proceed any further.
 
I have successfully defined Structure "Excel.[Global]" as follows:

Public Structure Excel
Shared Property [Global] As Object
End Structure

Note: It will not define correctly without the square brackets around 'Global', which supports my contention that 'Excel.[Global]' and 'Excel.Global' are not equivalent expressions.

...However, I still have one Build Error, "Type Excel.Global is not defined.", that is preventing the program from running. I still question whether an instance of 'Type Excel.Global' exists in the program. Could someone please help me get rid of that error?
 
Last edited:
The silence is deafening. Where do we go from here? Nobody has shown me where I'm wrong. Visual Basic.NET appears to be confusing 'Type Excel.Global' with 'Structure Excel.[Global]'. The ErrorList points at the UpgradeSupport Module as the location of the error. The instance of 'Excel.[Global]' in the UpgradeSupport Module is the only visible instance in the entire program, and there are no visible instances of 'Excel.Global' at all, anywhere. Is the Build Error the result of a bug in Visual Basic.NET, or what?
 
Within a bunch of those automated updates that appear when you shut down your computer were some that updated Visual Basic. The line in the UpgradeSupport module that used to read: "Friend ExcelGlobal_definst as New Excel.[Global]" now reads: "Friend ExcelGlobal_definst as New Microsoft.Office.Interop.Excel.Global", and Presto!, the error "Type Excel.Global is not defined" instantly disappeared. The program has other issues, but this particular one is closed! Thanks for whatever you did to get it fixed!
 
Back
Top