VB 2005 app and Access2010 issue with DAO - Possible Assembly Issue?

I wrote a VB 2005 program that provides an Automated LiveUpdate feature for my Access databases.

The LiveUpdate retrieves a version number in the MDB and compares it to one stored in a text file in a remote server.  If a newer version is available the download runs.

This program has been upgraded to work on Windows 7 and Access 2007.  It uses DAO for the database object. It also creates a secure workspace using dao.PrivDBEngine .

The code works fine with Win7/Access 2007.  But fails on Win7/Access2010. I made sure both the .NET framework (4.0)  and the Primary Interop Assemblies for Office 2010 are installed.
What’s odd is that my code breaks when I call my function. It does not beak within the function.
I placed some logging code right before the function call and then as the first line in the function.
It never get’s into the function.

Again, what stumps me is that it works fine with Access 2007 but not 2010.
Here is the error:
“Error : 53 Could not load file or assembly 'dao, Version=10.0.4504.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. “

The attached code has been stripped all superfluous info. (String Dimensioning, error trapping etc…)


CheckLatestVersion(ByRef strAppNameWithPath As String, ByRef strSecurityFile As String, ByRef strTablename As String, ByRef strFieldName As String) As String

Dim wrkExtDB As dao.Workspace
Dim dbEXT_TABLE As dao.Database
Dim dbs As dao.Database
Dim tdf As dao.TableDef

Dim usrNew As dao.User
Dim rs As dao.Recordset
Dim dbe As dao.PrivDBEngine
Dim wsp As dao.Workspace
Dim dbEXT_Database As dao.Database
Dim tbl As dao.TableDef
Dim fld As dao.Field

Dim tblCount As Short
'Create a secure workspace object     
dbe = New dao.PrivDBEngine
	With dbe
		strAdminUser = "ADMIN"
		strAdminPWD = "password"
		.SystemDB = strAPP_SecurityFile
		.DefaultUser = strAdminUser
		.DefaultPassword = strAdminPWD
	End With
wsp = dbe.Workspaces(0) 'systemdb is locked in now
'Create database object using the secure workspace
dbEXT_Database = wsp.OpenDatabase(strAppNameWithPath, False, True, strPassword)

tblCount = 0
'Look for the table ="tblTableWithVersionINfo". If found get the version number. Otherwise, return 0.001

For tblCount = 0 To dbEXT_Database.TableDefs.Count - 1

 	'If we find the table ="tblTableWithVersionINfo", then open it
	strTablename ="tblTableWithVersionINfo"
	If dbEXT_Database.TableDefs(tblCount).Name = strTablename Then 

 		rs = dbEXT_Database.OpenRecordset(strTablename)
		'Get the value from the field [strCurrentVersionNumber]
		strFieldName = "strCurrentVersionNumber"		
		If IsDbNull(rs.Fields(strFieldName).Value) Then
			CheckLatestVersion = "0"
			CheckLatestVersion = rs.Fields(strFieldName).Value
		End If
		rs = nothing
 		GoTo FinishRetrieval '(exit the app)
	 End If

Next tblCount

'If we get this far, the info was not found. Set a default version
 CheckLatestVersion = "0.001"
        On Error Resume Next
        dbEXT_Database = Nothing

Exit Function

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Are you sure that's the right version of DAO, and that you've referenced the correct Interops? It sounds as if you're using the incorrect version.

Check the references and report back here which you're using.

askolitsAuthor Commented:
See attached screen shot.
Does it look right?
Thanks. Live Update References
see link for problems with DAO/ADO library references between different versions of MS Access.  Compare your library references to the table in the link.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
askolitsAuthor Commented:
I'll have to wait till Monday to take a look at thgis again. I'll let you know.
askolitsAuthor Commented:
It seems the DAO reference wasn't needed. My guess is that tthe DAO objects are also in the Interop files for Access 2010. So, I think it caused a conflict. I removed the DAO reference and it's now working.
Thanks for pointing me in the right directtion.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.