Solved

Reference Error, What reference do I need?

Posted on 2014-03-05
4
450 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 48

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 85

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 48

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

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

688 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