根据文件位置更新记录 [英] Updating records based on file location

查看:69
本文介绍了根据文件位置更新记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列出文件名但不包含位置的信息数据库,然后我在网络驱动器上有一个物理文件夹结构,其中包含传真文件。有完成,等待批准或处理的文件夹。我正在寻找能够读取这些文件夹的内容并根据它所在的文件夹更新状态栏。

所以在一天开始时我们有:



-Fax1.tiff

-Fax2.tiff

-Fax3.tiff

-Fax4.tiff


已完成

-


正在进行中

-

在一天结束时,文件夹看起来像这样:



-Fax1.tiff


已完成

-Fax3.tiff

-Fax4.tiff


正在进行中

-Fax2 .tiff


我希望我的代码浏览这些文件夹,并根据文件夹更新每个文件名的状态。由于文件名是唯一的,我可以使用VBA打开文件夹,创建文件数组,然后通过创建两个单独的函数来设置状态,一个用于正在进行,一个用于完成并一个接一个地调用它们?


有没有人知道我可以收集一些信息以获得类似的东西?我承认VBA不是我最强的技能。

I have a database of information that lists the file name, but not location and then I have a physical folder structure on a network drive with the fax files in it. There are folders for done, awaiting approval, or processing. I?m looking for something to read those folders and update the status column based on which folder it is in.
So at the start of the day we have:
New
-Fax1.tiff
-Fax2.tiff
-Fax3.tiff
-Fax4.tiff

Finished
-

In progress
-

And at the end of the day the folders look like this:
New
-Fax1.tiff

Finished
-Fax3.tiff
-Fax4.tiff

In progress
-Fax2.tiff

I want my code to browse those folders, and update the status of each filename based on its folder. Since the file names are unique, could I use VBA to open the folder, create an array of the files and then set the status by creating two separate functions, one for in progress, one for completed and call them one after the other?


Does anyone know of anywhere that I could gather some information to get something like that started? I''ll admit that VBA isn''t my strongest skill.

推荐答案

Michael,


是的,你是什么要求肯定可以在VBA中完成。您的一些挑战可能与确保人们不会更改任何文件名有关。


但是,如果您要做的就是保留一份列表,列出哪些文件是在哪里,你可以创建一个报告(或电子表格 - 但是你想要这样做),列出每个文件夹中的文件名。


这取决于你想做什么,你想怎么做,以及你希望如何显示,存储或呈现结果。
Michael,

Yes, what you are asking can certainly be done in VBA. Some of your challenges may have to do with making sure that people don''t change any filenames.

However, if all you are trying to do is keep a list of which files are where, you could just create a report (or spreadsheet--however you want to do it) that lists the filenames in each folder.

It just depends on what you want to do, how you want to do it, and how you want the results displayed, stored or presented.


我之前应该提到的一件事是每天都会清除Finished文件夹。一旦数据库中的记录更新完成,我就不再担心了。我只需要能够列出已完成文件夹中的所有内容,并相应地更新数据库中的记录。所以我会将存储在数据库中的传真文件名(例如RF1-25_0303)与处理状态一起保存。如果该文件位于已完成的文件夹中,我希望能够运行一个宏,该宏可以自动更新它在数据库中的状态以完成。您是否认为数据库中文件的名称不包含.pdf扩展名可能是一个问题?


自动执行此过程可以节省大量时间更新数据库中传真的状态。


现在我想我可以使用只在处理状态下拉传真的查询,然后可能将它与存储文件夹中文件名的数组。请记住,这对VBA知之甚少,所以我可能会说些胡言乱语......


感谢您的回复!
One thing that I should have mentioned previously is that the Finished folder gets cleared out every day. Once the record in the database is updated to completed, I am no longer worried about it. I just need to be able to list everything that is in the finished folder, and update the records in the database accordingly. So I would have the file name of the fax stored in the DB (such as RF1-25_0303) with the status of processing. If that file is in the completed folder, I''d like to be able to run a macro that can automatically update it''s status in the database to completed. Do you think it could be an issue that the name of the file in the database does not include the .pdf extension?

Automating this process would save me a lot of time from manually having to update the status of the faxes in the database.

Right now I''m thinking that I could use a query that only pulls faxes in processing status and then possibly compare it to the array where the file names from the folder are stored. Keep in mind that this is with a limited knowledge of VBA so I could be talking in some gibberish...

Thanks for the response!


VBA可以非常轻松地使用文件夹和文件列表 - 我一直这样做。我想这可以做到。您还应该能够隐藏.pdf。显示文件时的扩展名,但无论哪种方式都可以使用。


我仍​​然需要知道你将如何使用数据。将表格中的所有内容都包含在内,但请记住,您将不得不经常从表中删除记录或将其标记为完整。


再次,所有这些取决于如何你想使用你的数据。
VBA can work very easily with file folders and lists of files--I do it all the time. I think this can be done. You should also be able to hide the ".pdf" extension when you display the file, but either way it can work.

I would still need to know how you are going to "use" the data. having everything in a table will work, but keep in mind that you will then either have to delete records from your table constantly or mark them as complete.

Again, all this depends on how you want to use your data.


这篇关于根据文件位置更新记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆