473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

I'm getting error message on a form that I've inherited

I get the following error message

Run-time error '2455' you entered invalid reference to the property FileSearch

'************************************************* **************************************
Expand|Select|Wrap|Line Numbers
  1. Set fs = Application.FileSearch
  2. With fs
  3.     ' Set search directory and file type to search for
  4.     .LookIn = strFileLocation
  5.     .FileName = strFileName
  6.  
  7.     ' Loop through found files and import
  8.     If .Execute > 0 Then
  9.         intNumFiles = .foundfiles.Count
  10.         For i = 1 To .foundfiles.Count
  11.             'strFileName = Right(.foundfiles(i), 12)
Sep 2 '09 #1

✓ answered by Megalog

If you're using Access 2007, then I'm sorry to inform you that the FileSearch object no longer exists. Yes, the help file is still there for it, and it might still exist in the object browser, but it -has- been removed.

Error message when you try to run the FileSearch function in Access 2007 (Microsoft Support kb/935402)

10 2436
FishVal
2,653 Expert 2GB
Looks like you need to reference "Microsoft Office xx.x Object Library".
In VBA window MainMenu -> Tools -> References.
Sep 2 '09 #2
Megalog
378 Expert 256MB
If you're using Access 2007, then I'm sorry to inform you that the FileSearch object no longer exists. Yes, the help file is still there for it, and it might still exist in the object browser, but it -has- been removed.

Error message when you try to run the FileSearch function in Access 2007 (Microsoft Support kb/935402)
Sep 3 '09 #3
was that functionality available in access 2003? I think this might have been copied over from Access 2003
Sep 3 '09 #4
Megalog
378 Expert 256MB
Yep, it was there previously. This was an undocumented (and really, unwarranted) removal for 2007. Google "Application.FileSearch" and you'll see a whole bunch of posts from angry/frustrated programmers.

If you look at the link I previously posted, microsoft has a few suggestions under the Resolution section that involve the FileSystemObject (FSO) Class. This is probably the best starting point to repairing whatever process they broke in your db.
Sep 3 '09 #5
FishVal
2,653 Expert 2GB
If you want to go with FSO, then just for starters you may read a series of articles in insights section of the forum concerning "Scripting Runtime" library.
This one is the first.
Sep 3 '09 #6
I've did additional research and a lot of the suggestions I've found online don't work. I am not well based in VBA, but I would think there has to be a way to substitute something else for Set fs=Application.FileSearch, the problem is finding an example that is close to what I'm trying to do.

What the form is supposed to do and did in Access 2003 is:
1) you enter a specific file which is in a csv format
2) click a button which will delete all old records from access table associated with csv file type
3)then it imports new records from the .csv file
Sep 4 '09 #7
NeoPa
32,556 Expert Mod 16PB
Have you actually explained what you want help with yet? It seems not.

Would I be right in thinking you are simply trying to import a specified CSV format file into a table in your database? If so, this is relatively straightforward. This doesn't require FileSearch though, so I'm still a little lost as to where you're coming from.
Sep 6 '09 #8
I asked did anyone know of a way to substitute something else for

Set fs=Application.FileSearch

This functionality existed in Access 2003 and now doesn't exist in Access 2007.. That was the question as stated earlier in the post thread.
Sep 8 '09 #9
NeoPa
32,556 Expert Mod 16PB
@Anthony97
Not in the original post clearly.
@Anthony97
If you're happy to limit the scope to that specific question then I'm not sure we can be more help (I certainly cannot limit my advice to such narrow boundaries).

Good luck.
Sep 9 '09 #10
Megalog
378 Expert 256MB
You're not going to be able to find a replacement that you can simply drop in and have your code work as it did before. Any of the 'replacements' you've found on the net have been tweaked or modified to death to fit people's various needs.

If I were you I'd start with Allen Browne's ListFiles method. This would generate a list of files into a collection, that you could then loop through and import.
Sep 9 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Brad Moore | last post by:
Hey All, I need help with debugging some code, if this isn't the correct newsgroup to ask in, disregard this message. I'm having difficulty pinpointing a memory leak in my code, I believe it...
1
by: orit | last post by:
I have the following xml file: <?xml version="1.0" encoding="utf-8" ?> <course id="2555" title="Developing Microsoft .NET Applications for Windows (Visual C# .NET)" length="5 days"...
15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
2
by: Giovanni Bassi | last post by:
Hello All, I have encountered a problem. I am using visual inheritance and my base form adds an event handler on Form Load using the AddHandler Keyword. The problem is that if the Event...
2
by: Peter | last post by:
I have a base form from which many forms inherit. The base form is in one project, and the inherits form is in another project. Both projects are under the same solution space. Both forms...
4
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on...
4
by: Mikus Sleiners | last post by:
I can't seem to add new controls to form that is inherited from another form. I have BaseForm wich have table layout on it 2 panelsm and some buttons. Now i create InheritedForm : BaseForm and...
2
by: srusskinyon | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
0
by: SM | last post by:
Hi, #1 I did some changes in my inherited form (change some properties of my components), now I want to rollback all changes made in inherited form and return to the same state as the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.