Create Directory for records in MS Access 2007

只愿长相守 提交于 2019-12-11 17:09:22

问题


Is it possible to create a directory folder for individual records in Access 2007. For example

tblUser
ID
firstName
surName

When adding a record, would create a folder C:\userdatabase\Surname,firstName,ID

Could see this being useful in situations for example where a large amount of images/files would need to be associated with a record. Access would create and link to a directory for each record.

Thanks in advance for any advice

Noel


回答1:


You can use the VBA MkDir statement to make a directory.

For example if you want to create a folder whose name matches one of your ID values, as a sub folder under the directory where your database is stored, you could use this code:

MkDir CurrentProject.Path & "\" & ID



回答2:


To create the entire directory structure with one command:

link text




回答3:


While these are all interesting answers to the question asked, I have to wonder why the original poster thinks this is necessary. If you're using your database to keep track of the information, it shouldn't really matter where the files are stored.

Of course, if you need to have access to the files from the file system, this can be a way to do it, but in my experience, usually not the most useful way (it segregates the data to too high a degree).

So, I'm basically saying to go back and question whether the design is correct or not. It very well may be, but you should be certain before committing to something like this, which I consider to be unnecessarily convoluted.



来源:https://stackoverflow.com/questions/2586450/create-directory-for-records-in-ms-access-2007

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!