Solved

Reference Error, What reference do I need?

Posted on 2014-03-05
4
447 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 200 total points
ID: 39906424
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
ID: 39906624
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
ID: 39906693
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
ID: 39937692
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

726 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