I get the following error message
Run-time error '2455' you entered invalid reference to the property FileSearch
'************************************************* ************************************** - Set fs = Application.FileSearch
-
With fs
-
' Set search directory and file type to search for
-
.LookIn = strFileLocation
-
.FileName = strFileName
-
-
' Loop through found files and import
-
If .Execute > 0 Then
-
intNumFiles = .foundfiles.Count
-
For i = 1 To .foundfiles.Count
-
'strFileName = Right(.foundfiles(i), 12)
10 2436
Looks like you need to reference "Microsoft Office xx.x Object Library".
In VBA window MainMenu -> Tools -> References.
was that functionality available in access 2003? I think this might have been copied over from Access 2003
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.
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.
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
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.
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.
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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"...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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
|
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...
| |