473,402 Members | 2,072 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,402 software developers and data experts.

need help to get file list onto form - using filepath from field on active form

13
i am lost. i cannot figure out how to make this work, because the dir= is not static but changes every time the form loads, and so, would appreciate help.

i have an access database 2003 (vb)

and one of the fields in the database contains the filepath for objects that are stored in various places (could be mp3, doc, pdf, xls - etc)on the drive.

i have a form that displays a record, including (among other things) the filepath, but not the objects/files found in the filepath folders

i would like to have the form load, and display a list of the objects/files found in the folder for the file path displayed on the active record - in a separate field but on the same form

i would like it to refresh if new objects/files have been added since the last view

i would like to be able to generate a report that shows the objects/files in the file path on the active form and that will update when new objects/files are added

if you need more information please get back to me.
Feb 18 '11 #1

✓ answered by Guido Geurs

sorry for the misunderstanding (I was trying to list from VB6 via an access DB).
The problem is in VBA access or not ?
If so, please place the call in the forum "Microsoft Access / VBA".
Access is not my dada but I have found next:
where
TextFolderPath.Text: textbox wih link to datafield with path of folders.

Expand|Select|Wrap|Line Numbers
  1. Dim sFile As String
  2. Dim FilePath As String
  3.    FilePath = TextFolderPath.Text
  4.    If FilePath <> "" Then
  5.       sFile = Dir$(FilePath & "\*.*", vbNormal Or vbHidden Or vbSystem Or vbReadOnly Or vbArchive)
  6.       TextList.SetFocus
  7.       TextList.Text = ""
  8.       Do Until sFile = ""
  9.          TextList.Text = TextList.Text & FilePath & "\*.*" & sFile & vbNewLine
  10.          sFile = Dir$()
  11.       Loop
  12.       Form_TblFolders.SetFocus
  13.    Else
  14.       MsgBox "record is empty"
  15.    End If

7 2268
Guido Geurs
767 Expert 512MB
Add a Filelistbox to the form and set the File1.path = path from the record in the DB.
To refresh the contents of the list: enter the code= File1.refresh
To dump the contents of the list:
Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer
  2. Dim TEXTCONT As String
  3. For i = 0 To File1.ListCount - 1
  4.    TEXTCONT = TEXTCONT & File1.List(i)
  5. Next
You can now send it to the printer or a file.
Feb 20 '11 #2
katia
13
Hello Guido;
Thank you. I have tried this but it does not work. I have the File1 = using DLookup - is this the wrong approach? It gives me errors and does not like it as file path.........

Dim File1 As String
File1 = DLookup("[File_Path_On_Network]", "[Records Investments Group]")

Dim i As Integer
Dim TEXTCONT As String
For i = 0 To File1.ListCount - 1
TEXTCONT -TEXTCONT & File1.List(i)
Next
Feb 21 '11 #3
Guido Geurs
767 Expert 512MB
File1 is the name of the filelistbox.
You have to set the path from the database to the component FilelistBox.
Like:
Expand|Select|Wrap|Line Numbers
  1. Dim FILEPATH As String
  2. FILEPATH = ??? '§ Path from the database
  3. File1.Path = FILEPATH
You have to replace the ??? with the data from the record in the database !
Feb 22 '11 #4
katia
13
' problem with DLookup and lstFilesInDirectory.Path is
' errors - why? *sharp stick in eye*


Dim FILEPATH As String
FILEPATH = DLookup("[File Path on Network]", " Records Investments Group") = Form![Records Investments Group ALL Fields]
lstFilesInDirectory.Path = FILEPATH

Dim i As Integer
Dim TEXTCONT As String
For i = 0 To lstFilesInDirectory.ListCount - 1
TEXTCONT = TEXTCONT & lstListofRecords.List(i)
Next
Feb 23 '11 #5
katia
13
FYI: is populating but with a list of sequential numbers, if you click on the list box - gets compile error: method or data member not found. (lstFilesInDirectory.Path
Feb 23 '11 #6
Guido Geurs
767 Expert 512MB
sorry for the misunderstanding (I was trying to list from VB6 via an access DB).
The problem is in VBA access or not ?
If so, please place the call in the forum "Microsoft Access / VBA".
Access is not my dada but I have found next:
where
TextFolderPath.Text: textbox wih link to datafield with path of folders.

Expand|Select|Wrap|Line Numbers
  1. Dim sFile As String
  2. Dim FilePath As String
  3.    FilePath = TextFolderPath.Text
  4.    If FilePath <> "" Then
  5.       sFile = Dir$(FilePath & "\*.*", vbNormal Or vbHidden Or vbSystem Or vbReadOnly Or vbArchive)
  6.       TextList.SetFocus
  7.       TextList.Text = ""
  8.       Do Until sFile = ""
  9.          TextList.Text = TextList.Text & FilePath & "\*.*" & sFile & vbNewLine
  10.          sFile = Dir$()
  11.       Loop
  12.       Form_TblFolders.SetFocus
  13.    Else
  14.       MsgBox "record is empty"
  15.    End If
Feb 24 '11 #7
katia
13
It is Access VBA! -and- Thank you for your help.
Feb 25 '11 #8

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

Similar topics

3
by: Ben | last post by:
Hi all, i have file input field in a form like this: <input name="isbn" type="text" size="25" value="<?php echo $_POST ?>" /> <input name="image" type="file" size="25" value="<?php echo...
1
by: John Pastrovick | last post by:
Is there a way to load an image locally (in the client) when a selection of a file is made using input type=file. The purpose is to allow selection of a file and put the image in the browser...
3
by: Matt | last post by:
The user can select a file in the file open dialog using <input type="FILE">, but the user can also enter the full file path in the browse text box manually. My question is if there are JavaScript...
3
by: Wayne Aprato | last post by:
I am using code kindly provided by the Access Web to capture a file path and insert it into a form. The relevant part of the code follows: Function GetOpenFile(Optional varDirectory As Variant,...
3
by: Mark | last post by:
Hello all - I'm at wits end with trying to figure out why I'm having this problem since I followed the research, that I've dug up, to a "T". I'm trying to display a JPEG image from a path...
3
by: Vibhu | last post by:
Hello All, I have a input box on the HTML page with the type set to file. What I want is that when the value changes in the file textbox, it should give me the full file path. I have even tried...
5
by: cssExp | last post by:
alright suppose i have the following. <input type="file" name="upload" /> <input type="text" name="discription" /> <input type="image" onclick="addFile();" src="images/addfile.jpg" name="add"...
7
by: sdanda | last post by:
I am working on windows applications(VB.net). I created a form with a textbox and one button. I would like to test the value entered in the textbox after this textbox loses the focus. The value...
3
by: NobodyImportant | last post by:
Hello everyone! I admit up front that I am new at this and have very little knowledge of JavaScript, but we have an asp web form that allows for the manipulation of letters our company regularly...
2
by: timleonard | last post by:
How do you reference the Table:Field to use in a file path? I have been trying the code below I would like to reference a Tablel:Field to use in the path instead of hard coding the file name,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
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,...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
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...

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.