Posted by: robinschroeder | September 4, 2009

Changing Access library references dynamically

Had a problem with an Access application that requires the Outlook library to email. Some users were using office 2003 (office 11) and others office 2007 (office 12). The access app is running in the 2003 runtime. We were getting ‘Library not Registered’ errors when users were using office 12 when the reference was pointing to the office 11 version. You can’t reference BOTH versions, so I wrote some code to remove any existing outlook references and detect and set the proper reference when the main switchboard loads. 

  ’remove any references to outlook (this is probably mine from development)
    Dim referenceItem As Reference
    For Each referenceItem In References
        If (referenceItem.FullPath = “C:\Program Files\Microsoft Office\OFFICE11\MSOUTL.OLB”) Then
            References.Remove referenceItem
        ElseIf (referenceItem.FullPath = “C:\Program Files\Microsoft Office\OFFICE12\MSOUTL.OLB”) Then
            References.Remove referenceItem
        End If
    Next referenceItem
   
    ‘find a reference and use it
   If (Dir(“C:\Program Files\Microsoft Office\OFFICE11\MSOUTL.OLB”) <> “”) Then
        References.AddFromFile “C:\Program Files\Microsoft Office\OFFICE11\MSOUTL.OLB”
    ElseIf (Dir(“C:\Program Files\Microsoft Office\OFFICE12\MSOUTL.OLB”) <> “”) Then
        References.AddFromFile “C:\Program Files\Microsoft Office\OFFICE12\MSOUTL.OLB”
    End If

Posted by: robinschroeder | June 21, 2009

Access 2003 on Vista, Error #3075

I maintain a MS Access 2003 application for a client. The front end sits in a shared directory on their network and they use a bat file to copy the mdb file locally and execute it in the Access Runtime (ART). The back end is MS SQL Express 2005. They just recently tried to install it on their first Vista machine and they encountered an error: Error #3075: Function is not available in expressions. This error occurred on many but not all of the calls back to the database. It obviously had something to do with the references. Upon comparing the references between the same app running on Win Server 2003 and Vista, I found that all of the references were the same except:

Vista: Microsoft ADO Ext. 6.0 for DDL and Security (WDAC 6.0)

Win Server 2003/XP: Microsoft ADO Ext. 2.8 for DDL and Security (MDAC 2.8)

In Vista, they replaced the MDAC 2.8 (Microsoft Data Access Components) with WDAC 6.0 (Windows Data Access Components). These components include ADO, OLE, DB and ODBC. 

I really didn’t feel like messing with rolling back to MDAC 2.8 or trying to make both versions run on the same machine. So, I just tried reordering the references. I moved WDAC 6.0 up as far as I could – second from the top and viola – no errors!

MM-reference problem vista1

I moved the last reference (not the highlighted one) up to second from the top.

So, if the app is runing in the Access Runtime, how did I get to the VB References?? Well, this particular machine had the full version of Access installed on it. I have no clue what I am going to do when it is only running the Access Runtime. I guess I will have to amend this post… ;-)

Posted by: robinschroeder | June 20, 2009

First Blog Post

Ok, first blog post. I had a blog a while back and didn’t keep it up. This one will mainly be for programming things that I come across and need to remember how to fix. Occassionally, I will need to vent about kid stuff and life. Mostly programming. ;-)

Categories