PC Review


Reply
Thread Tools Rate Thread

2007 Access error 2455 on Filesearch

 
 
New Member
Join Date: Jun 2010
Posts: 6
 
      24th Jul 2010
I have a 2002 access database that verifies a file is resident (using FileSearch) before trying to import it (see MY CODE). This works fine on the PC's that have Access 2002 but aborts on those that have 2007.

When I click on the command to run the module I get:
Run-time error '2455": You entered an expression that has an invalid reference to the property FileSearch.

I tried looking at Micosoft help for this issue, but according to it, my code is fine (See Microsoft Help). When I step through the code, the error pops up as soon as I try to "Set fs = Application.FileSearch". Can anyone see what I may be overlooking?

MY CODE:

Function PORT_USAGE_IMPORT_WED()
Dim Inputport, loadedport, Mystr, Mydate, fs, Sortby
Set fs = Application.FileSearch
On Error GoTo PORT_USAGE_IMPORT_WED_Err
Mydate = Date - 1
Mystr = Format(Mydate, "mmddyy")
Inputport = "U:\portusage\Wed\port_111_0000.CSV"
loadedport = "U:\portusage\Imported\Wed\" & Mystr & "_port_111_0000.CSV"
With fs
.LookIn = "U:\portusage\Wed\"
.FileName = "port_111_0000.CSV"
' THERE ARE SEVERAL FILES UNDER "U:\portusage\WED\" that I look for
If .Execute > 0 Then
DoCmd.Echo True, "IMPORTING PH111 Midnight PORT USAGE DATA."
DoCmd.TransferText acImportDelim, "IMPORT_PORT_USAGE", "WED_PORT_USAGE_111", "U:\portusage\Wed\PORT_111_0000.CSV", False, ""
Name Inputport As loadedport
Else
MsgBox "portusage\Wed\port_111_0000.CSV file not found."
End If


MICROSOFT HELP:
Office Developer ReferenceFileSearch.LookIn Property
Gets or sets the folder to be searched during the specified file search. Read/write
Syntax

expression.LookIn

expression A variable that represents a FileSearch object.



Example
This example searches the My Documents folders for all files that begin with "Cmd" and displays the name and location of each file that’s found. Visual Basic for ApplicationsSet fs = Application.FileSearchWith fs .LookIn = "C:\My Documents" .FileName = "cmd*.*" If .Execute > 0 Then MsgBox "There were " & .FoundFiles.Count & _ " file(s) found." For i = 1 To .FoundFiles.Count MsgBox .FoundFiles(i) Next i Else MsgBox "There were no files found." End IfEnd With
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileSearch in Access 2007 Anthony Ching Microsoft Access VBA Modules 5 24th Jun 2009 04:09 PM
Access 2003 - Error Code 2455 imelda1ab@yahoo.com Microsoft Access Form Coding 4 26th Oct 2007 05:56 PM
2455 Error when navigation bar set to not show Access 2007 =?Utf-8?B?TG91dmVycmls?= Microsoft Access Forms 0 25th Sep 2007 12:48 PM
Error 2455 Closing Access 2007 database with form open =?Utf-8?B?TG91dmVycmls?= Microsoft Access 1 10th Sep 2007 05:58 PM
Cant access PC from network - unknown error 2455 Ajay Bhagat Microsoft Windows 2000 0 8th Sep 2003 08:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:03 PM.