?
Solved

Reference Error, What reference do I need?

Posted on 2014-03-05
4
Medium Priority
?
455 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 earned 800 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 200 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
Dale Fye earned 800 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

765 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