Hi,
I've found code in thread:
Using FileDialog property to open File and display FileName in a textbox
but:
1. I do not know how to add it in to ACCESS 2003 database.
2. I have fields in database with FirstName, LastName and IDnumber. How to Create folder named "LastName FirstName IDnumber" from ACCESS 2003 (on a click on a batton)?
3. And, additionaly, is it possible to add all files from this folder (folder created and opened in previous step) on a list on the form (or as labels-hyperlinks on current form)?
Thanks in advance
2 4305 @sajtovi007
Hi
To get you started the following code can be moded to your database to create a new directiory - Sub CreateDirectory()
-
Dim rs As New ADODB.Recordset
-
Dim SQL As String
-
-
SQL = "SELECT FName, SName, ID FROM tblContacts WHERE ID = 2"
-
rs.Open SQL, CurrentProject.Connection, adOpenStatic, adLockReadOnly
-
-
MkDir "C:\" & rs("FName") & " " & rs("SName") & " ID is " & rs("ID")
-
-
rs.Close
-
Set rs = Nothing
-
End Sub
and to obtain a list of selected files in a gived directory some thing like this perhapse - Sub ListFiles()
-
Dim dlgOpen As FileDialog
-
Dim ThisFilePath As Variant
-
Dim FileName As String
-
Set dlgOpen = Application.FileDialog(msoFileDialogFilePicker)
-
-
With dlgOpen
-
.AllowMultiSelect = True
-
.Filters.Add "Excel Files", "*.xls", 1
-
If .Show = -1 Then
-
For Each ThisFilePath In .SelectedItems
-
FileName = Mid(ThisFilePath, InStrRev(ThisFilePath, "\") + 1)
-
MsgBox FileName
-
Next ThisFilePath
-
End If
-
End With
-
End Sub
This assumes you want to select the directory manualy (if not i don't know how you will now wich directories exist). A plausible alternative is to use the DIR function (see Access help or post back if you need a pointer or two on that).
There is another alternative using the FileSystemObjec t (this will need a reference to the 'Microsoft Scripting Runtime' Library) but that is even more stuff to learn, not a bad think, but you can't learn it ALL at once!!.
Hope this helps
MTB
ADezii 8,834
Recognized Expert Expert @sajtovi007
Download the Attachment to see how to select a File from the File Dialog, then to display its Absolute Path in a Text Box.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: kyma via .NET 247 |
last post by:
Hi,
I haveto use VB to create a form that reads an exisiting XML fileand then allows updates via the VB form.
My problem is that I was able to get VB to read a simple XML file(people.XML), but I'm having problems figuring out how to get VBto read a more complex XML file (people2.xml) and then useadditional text boxes on the same form to add more familymembers. Each family can have from 1 to 5 members.
I've pasted the working code below...
|
by: Random Person |
last post by:
Does anyone know how to use VBA to relink tables between two MS Access
databases? We have two databases, one with VBA code and the other with
data tables. The tables are referenced by linked tables in the database
where the code resides. If we move the database with the data tables to
a new directory, the links are no longer valid.
I tried to update the links by changing the Connect property and refreshing:
Set td = db.TableDefs(0)...
|
by: Grasshopper |
last post by:
Hi,
I am automating Access reports to PDF using PDF Writer 6.0. I've
created a DTS package to run the reports and schedule a job to run this
DTS package. If I PC Anywhere into the server on where the job is
running, the job runs sucessfully, PDF files got generated, everything
is good. If I scheduled the job to run at the time that I am not
logged into the server, Access is not able to print to the printer.
The error is pretty...
|
by: Daveyk0 |
last post by:
Hello there,
I have a front end database that I have recently made very many changes
to to allow off-line use. I keep copies of the databases on my hard
drive and link to them rather than the live databases on the network.
Is there a way, via code, when I get back in-house from being on the
road to click a button, and select the backends I want to link to?
I would want to delete all the current links and link to the "live"
|
by: Michelle Keys |
last post by:
I am trying to call a print function to print a string from a database
using javascript.
Which is RC_DATA of Varchar2(2500).
This is a javascript is not being used. I have a thing that needs to be
modified:
if(e.CommandName =="Print")
{
string parsedreceipt = null;
parsedreceipt = DecodeReceipt (e.Item.Cells.Text);
Session = parsedreceipt;
| |
by: Roman |
last post by:
I'm trying to create the form which would allow data entry
to the Client table, as well as modification and deletion
of existing data rows. For some reason the DataGrid part
of functionality stops working when I include data entry
fields to the form: I click on Delete or Edit inside of
DataGrid and get this error: "Error: Object doesn't
support this property or method"
If I remove data entry fields from the form - DataGrid
allows to...
|
by: zino |
last post by:
I'm using the following code to get the file name and path, but after the
user click the file, Excel open it.
I don't want the Excel file to open, all I need is to get the file name that
the user selected from the FileDialog box to pass it to excel object:
With
xl.FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogFilePicker)
..AllowMultiSelect = False
..Filters.Clear()
..Filters.Add("Excel Files",...
|
by: sck10 |
last post by:
Hello,
I am creating a form for users to enter information about a lab and the
members of the lab. I have one form (FormView) that they use to enter
information about that lab. The keyvalue is "LabLocation_ID". With an
existing lab, they then need to add the members for that lab. So, what I am
trying to do is the following. With the FormView of the Lab open, the user
will click a button to open a FormView (InsertMode) and add a new...
|
by: technocraze |
last post by:
Hi pals,
I would like to know how to display the FileName of the selected file in the textbox and open it using FileDialog property. I have imported the necessary reference from the library - Microsoft Office Object Library 10.0. Tks
Control:
TextBox - Display FileName
Button - Open
Code:
|
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:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |