Solved

Reference Error, What reference do I need?

Posted on 2014-03-05
4
429 Views
Last Modified: 2014-03-18
We a moving our Access 2003 applications designed and running on Win/XP to Win7 machines running Access 2010 - 32 bit.  For the most part it's going smoothly but I ran into a reference error in the included routine.  The error:

Error 2455 - You entered an expression that has an invalid reference to property Filesearch.

The error is being thrown on statment
Dim MySearch As Office.FileSearch

This was working fine in Access 2003, Win XP.

I checked the references  on the Win 7 machine and there are no missing or broken references showing.  

What reference am I missing?

Public Sub buildTablesAndTimeStamps()
'
Dim pathAndMDBName As String
Dim MDBName As String
Dim currPath As String
Dim linkedDrive As String
Dim linkedPath As String
'
linkedPath = getLinkedPath
linkedDrive = Mid(linkedPath, 1, 1)
'
currPath = GetProcMDBPath
currPath = linkedDrive & Mid(currPath, 2)
'
ClearTable ("tblCheckTableTimeStamps")
'
    Dim MySearch As Office.FileSearch
    Dim intI As Integer, strList As String, strPath As String
    strPath = currPath   '"C:\"
    Set MySearch = Application.FileSearch
    With MySearch
        .NewSearch    'initialize search (clear old settings)
        .LookIn = strPath   'start point for search
        .FileName = "CI*.MDB"    'file name (takes wildcards)
        .SearchSubFolders = False    'scan folders inside first folder
        .Execute
        
        '.FoundFiles contains the list of filenames found as a collection
        For intI = 1 To .FoundFiles.Count
            pathAndMDBName = .FoundFiles(intI)
            MDBName = Trim(Replace(pathAndMDBName, strPath, ""))
            '
            ' Do not add 'Over' tables since they aren't updated every day anyway
            '
            If InStr(1, MDBName, "over") > 1 Then
            Else
                addAuditTable pathAndMDBName, MDBName
            End If
            'Debug.Print .FoundFiles(intI); "       "; MDBName
        Next intI
    End With
    '
End Sub

Open in new window

0
Comment
Question by:mlcktmguy
  • 2
4 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 200 total points
Comment Utility
It will be named something like:

Microsoft Office XX.X Object Library

where XX.X is something less that 12.0, I don't remember what the # was for Office 2003 of the top of my head.
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 50 total points
Comment Utility
Remember too that the Filesearch object is part of the Office library, not Access, so the machines will need the full version of Office installed on them.
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 200 total points
Comment Utility
Somehow missed that you were migrating to 2010,  that reference should be to:

Microsoft Office 14.0 Object Library
0
 
LVL 7

Expert Comment

by:COACHMAN99
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now