ListBox Populate Directory Based On User Input

djreyrey

Registered User.
Local time
Today, 04:07
Joined
Nov 19, 2005
Messages
25
Hello! Thank you for your assistance. I apologize for the long post but I want to make sure it's detailed.

On my Documents form, would it be possible to have a text box where the user enters an order #, clicks a command button and displays the directory (which is the order #) in a listbox?

Currently, the Main form creates a folder on the computer with the same name as the order # (ID) when a new record is created. For example, if the new order # is 100, the database will create a new folder called 100 after the record is inserted.

So, once the record and the folder are created, the user will open the Documents form to view documents that are available, enter the order # in a text box, and click a command button. After the command button is clicked, the listbox should pull up the directory based on what the user entered in the text box.

If the user enters order # (ID) 100 in the textbox, Access will look for directory c:\RealEstate\100 and populate the lisbox with the contents of directory c:\RealEstate\100.

I appreciate your assistance and hope this post makes sense.
 
Do search on this forum for 'ListFiles' and 'FillDir'
I you cant find anything then get back to me and I will search though some old sample databases.
 
ZigZag,

Thank you for those suggestions. I found a few things that were close to what I would like to do. Nothing solid.

The thing is - I'd like for the user to enter the folder name in a text box and for Access to populate the contents of the folder name in a listbox. Is this even possible? Do you have any better ideas of how to accomplish this?

HiTechCoach,

I tried the example you provided once before and was successful. The problem here is that the path name is hard coded. If somehow I could tell access to grab the current record ID as the folder name to populate in the listbox, that would be great!
 
ZigZag,

Thank you for those suggestions. I found a few things that were close to what I would like to do. Nothing solid.

The thing is - I'd like for the user to enter the folder name in a text box and for Access to populate the contents of the folder name in a listbox. Is this even possible? Do you have any better ideas of how to accomplish this?

HiTechCoach,

I tried the example you provided once before and was successful. The problem here is that the path name is hard coded. If somehow I could tell access to grab the current record ID as the folder name to populate in the listbox, that would be great!

The code ithe example will use any folder path yyopu pass it. The example was just passing a hard coded path since the example was not in how to to pick the path but to read the path into a list box. The example coudl has allowd you to use any folder.


If you have a text box on your form named: txtFolder then you would call the code in the example liek this"

PopListBox(Me.txtFolder)
 
HiTechCoach,

OMG! That's genious! I added the piece of code you suggested to a command button and it worked! It worked! Thank you so very much!!
 
I've got one last question regarding the module that's used for this listbox - how can I control the alignment of each column that appears in the listbox? I changed the numbers around where the "-" is but not much changes. This is just cosmetic tweaking.

Currently, my listbox appears like this:

File 1 ------------- 09/20/09
File 1 Extra ------------- 01/05/08
File ------------- 05/07/07
File 2 Extra Long Name ------------- 09/05/01
 

Users who are viewing this thread

Back
Top Bottom