I'm sure that this is possible:
I have a parent directory that has sub directories. Each sub directory will store certain files in certain formats, i.e. i have 1 directory for excel, 1 for word... and so on. As an example i have a sub directory called FinalDocumentat ion that will store excel files based on my final documentation template.
Every file will have the same convention i.e.
TXX_08-Mar-2007_Final_Docu mentation_Joe_S mith.xls
TXX = client id
08-Mar-2007 = Today's date
Final_Documenta tion = Document Name (Is really the directory it's in)
Joe_Smith = Person who created this file
I'm having this problem: I want the user to enter a client id on a form upon which this function will kick in and search for any files, in my sub directories, that have a TXX and insert them into a temporary table so that i can display them in an datasheet.
I don't need the insert code, i could do that, i would like some assistance in the actual finding of the file.
I know what you will say, i can save these in a table when i create the initial file, but unfortunately this is not an option.
4 1917 Rabbit 12,516
Recognized Expert Moderator MVP
Here's some sample code that I use to search the folder the database is in and then populates a textbox with the filenames. - With Application.FileSearch
-
Dim length As Integer
-
length = Len(Application.CurrentProject.path) + 2
-
.NewSearch
-
.LookIn = Application.CurrentProject.path
-
.SearchSubFolders = False
-
.FileName = "Test"
-
.MatchTextExactly = False
-
.FileType = msoFileTypeDatabases
-
-
If .Execute() > 0 Then
-
Dim i As Integer
-
Dim Files As String
-
Files = "'" & Mid(.FoundFiles(1), length) & "'"
-
For i = 2 To .FoundFiles.Count
-
Files = Files & ";'" & Mid(.FoundFiles(i), length) & "'"
-
Next i
-
FileList.RowSource = Files
-
Else
-
FileList.RowSource = "'No Files Found.'"
-
End If
-
End With
Is your piece of code going to find all the file or only files for a specified client id.
Let's say i only want to search for files that have a TXX.
Only excel and word files will be stored that's all.
Rabbit 12,516
Recognized Expert Moderator MVP
My code will find all Database files that have the word Test in it.
You can customize the search to your needs by changing the properties.
NeoPa 32,579
Recognized Expert Moderator MVP
You could put together some code quite easily to use Dir() I would have thought. Dir Function
Returns a String representing the name of a file, directory, or folder that matches a specified pattern or file attribute, or the volume label of a drive.
Syntax Dir[(pathname[, attributes])]
The Dir function syntax has these parts:
Part Description pathname Optional. String expression that specifies a file name — may include directory or folder, and drive. A zero-length string ("") is returned if pathname is not found. attributes Optional. Constant or numeric expression, whose sum specifies file attributes. If omitted, returns files that match pathname but have no attributes.
Settings
The attributes argument settings are:
Constant Value Description vbNormal 0 (Default) Specifies files with no attributes. vbReadOnly 1 Specifies read-only files in addition to files with no attributes. vbHidden 2 Specifies hidden files in addition to files with no attributes. VbSystem 4 Specifies system files in addition to files with no attributes. Not available on the Macintosh. vbVolume 8 Specifies volume label; if any other attributed is specified, vbVolume is ignored. Not available on the Macintosh. vbDirectory 16 Specifies directories or folders in addition to files with no attributes. vbAlias 64 Specified file name is an alias. Available only on the Macintosh.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tony Houghton |
last post by:
I'm using pygame to write a game called Bombz which needs to save some
data in a directory associated with it. In Unix/Linux I'd probably use
"~/.bombz", in Windows something like
"C:\Documents And Settings\<user>\Applicacation Data\Bombz".
There are plenty of messages in the archives for this group about how to
find the correct location in Windows, but what about Mac OS? There I
don't know the correct location for this sort of thing at...
|
by: Carlitos |
last post by:
Hi there,
I do not have much experience nor knowledge about security in ASP.NET nor
Windows, so I apologize if I sound naive in this question.
I developed a web application and a DLL that the web application uses. This
DLL moves files from the web server to a shared folder in a different server
in the intranet. It seems ASPNET user account can move some files but not
all types of files because it does not have enough permissions to...
|
by: Xavier MT |
last post by:
Does anybody know how to start a download programatically but first check
who is actually downloading the file?
|
by: mg |
last post by:
How can I print PDF files programatically. I'm using a WebForm/C# (not a
Windows Form) app. I want to print a number of PDF files in a batch without
user intervention.
I know how to stream a pdf file to a browser and manually print it there
with Acrobat Reader. This latter approach is not what I'm looking for.
|
by: Usman Ghani |
last post by:
HI All,
I used to drag drop Datasets and adapters etc, and once dataset is
filled, I can count rows in a dataset as
datasetname.tablename.rows.count
I started doing all this programatically, now when I write
datsetname...... nothing appears?
Any one can help me pls?
| |
by: Gancy |
last post by:
Is there a way to programatically find a SMTP server available on the
network? I am writing a C#.Net program, which should first find a SMTP
server on LAN and use that SMTP server to send an email.
Thanks
Ganesh
|
by: planetthoughtful |
last post by:
Hi All,
Just wondering if anyone can tell me if it's possible to
programatically save Access2003 code (ie code behind forms, as well as
class modules) to external files?
I'd like to use versioning software to keep track of code changes, but
this would require being able to save the files easily to *.cls and
*.bas files.
|
by: carson |
last post by:
I have written two windows services:
- service A does some crunching of local data files and uploads them to
a central processing computer via http.
- service B monitors a manifest file on a webserver to see if service A
needs to be updated.
What service B does if it sees their is an update for service A is to
download a new copy of the service A executable, stop service A,
replace the executable with the new copy, and start service B...
|
by: BobLewiston |
last post by:
Can anybody tell me how to change WinForm controls' text color programatically? I have no problem finding the fields to assign colors to, but the compiler doesn't recognize any color I mention, whether it's something like WindowText, or something like Red.
BTW, I'm using VC# Express 2008.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |