出错时,删除要在文件夹中导入的文件 [英] On error, delete file to be imported in a folder

查看:85
本文介绍了出错时,删除要在文件夹中导入的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从文件夹c:\ RT \rfidlogs \中导入我的扫描仪创建的文件。夹。

如果导入的数据类型不是数字类型格式,那么我想删除那里的文件,比如

I import files created by my scanner from the folder "c:\RT\rfidlogs\" folder.
If the data type imported is not in number type format, then i would like to delete files in there using something like

展开 | 选择 | Wrap | 行号

推荐答案

neelsfer,


我一直玩这篇文章已经有一段时间了,我知道我想要什么&与它有关,但Access VBA不允许它。我想使用CInt()函数将文件中的数据转换为整数数据类型。如果数据无法转换为整数,那么,我们期望一个错误,执行一些错误检查代码,这将删除该文件。但是,我无法获取我的代码来捕获该错误。访问直接进入错误模式,而不进入我的错误处理代码。


仍在修补此问题。也许其他人有一些想法???
neelsfer,

I have been playing with this post for quite a while, and I know what I "want" to do with it, but Access VBA is not allowing it. I want to use the CInt() function to convert the data in the file to an integer data type. If the data cannot be converted to an integer, then, we expect an error, to perform some error checking code, which would be to delete the file. However, I can''t get my code to trap that error. Access goes straight to error mode, without going into my error handling code.

Still tinkering with this. Perhaps someone else has some ideas???


我导入的文件看起来像这样。在vba中正确设置文件夹。它将数据放入此文件夹的表中。在vba的第12行,我假设可以说如果它不是askii 0-9,那么你删除带有*。OUT的文件。扩展。

thx





The file i import looks like this. Set the folder correctly in vba. It puts data into a table from this folder. In line 12 of the vba, i assume one can say if it is not askii 0-9, then you delete the file with the "*.OUT" extention.
thx
附加文件
(34.0 KB,41 views)
Attached Files
(34.0 KB, 41 views)


neelsfer,


我想我可能找到了适合你的解决方案。我已经设置了一个子循环遍历每个文件名,然后逐个字符地遍历该文件中的数据,以查看是否存在任何非整数字符。字符。如果有,则删除该文件。如果没有,则将数据添加到数据库。


请告诉我这是否会让您走上正确的轨道.....

neelsfer,

I think I may have found a solution for you. I''ve set up a sub to loop through each file name, and then loop through the data in that file, character by character, to see if there are any "non-integer" characters. If there are, then delete the file. If there are not, then add the data to the DB.

Please let me know if this gets you going down the right track.....


展开 | 选择 | Wrap | 行号


这篇关于出错时,删除要在文件夹中导入的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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