Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a folder when new person added 1

Status
Not open for further replies.
Apr 19, 2000
73
US
Access 2000 or 2002
I am creating a photo gallery database that stores the name of each person and a link to each photo they have.
What I would like is for access to automatically create a new windows folder with the persons name as the folder name every time a new person is added. Is this possible? If so, how?
Thanks for any help.
 
If i do a mkdir should i put this in afterupdate event on the form? Also if a persons name is edited (like someones name changes) how can I autoupdate the folder name?
 
Well.. for me, i use it to create a folder through a button.

So the onClick event is when the folder is created. You will also need to check to see if the folder is created, so use an error trap to do nothing if you have already created the folder.

I would also include a field that would store some of the path to the server or computer that the pictures or folder is located.. then cocantentate the fields together:

like:

dim strServerPath as String
dim strClientName as String

StrClientName = dLookUP("ClientName", "tblClients", "ClientID = "& ME!ClientID)

strServerPath =dLookUP("tblManagementTable", "ServerPath", "ID= "& 1)

' then put the fiels together and presto

mkDir strServerPath & strClientName
 
It works. cool stuff. Thanks.
One more quick question. How do I create a command button that will list the contents of that particular persons folder?
 
oh.. i saw that on here somewhere. do a couple of searches. I'm sure you'll find it. Somehow you can pull file names and list them in a drop down box
 
Hi

See the dir() function in help Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
One way to list the contents is to simply open the folder using explorer. Here's code that can be placed on a buttons OnClick event:

Private Sub OpenFileFolder_Click()
On Error GoTo Err_OpenFileFolder_Click

Dim stAppName As String
Dim stFolderName As String

stPathName = "c:\winnt\explorer C:\ProjectFolder\"
stFolderName = [UsernameField]
stAppName = stPathName + stFolderName
Call Shell(stAppName, 1)

Exit_OpenFileFolder_Click:
Exit Sub

Err_OpenFileFolder_Click:
MsgBox Err.Description
Resume Exit_OpenFileFolder_Click

End Sub


 
Yes.. I could have suggested the dir(), but there is a way to list the contents of a folder while still in access. I thought that would be cooler.

You can either use Reilly's code, or a link field. Using the code is probably a better idea, since you won't have to worry about adding a new field to your table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top