确定A:驱动器是否为空 [英] Determine if A: drive is empty

查看:77
本文介绍了确定A:驱动器是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将数据保存到A:驱动器的宏。如果驱动器是空的并且我运行了宏,那么驱动器会点击几次,然后会出现一条消息,说

文件已经存在,我想要吗?过来写它。我认为这将是一个巧妙的技巧,所以我点击是,驱动器仍然是空的。消息来了

说访问不能写入文件。我点击确定,然后会打开一个窗口显示

宏已经失败并让我有机会停止它。


我想进行宏检查在

尝试写入数据之前,查看是否存在软盘。我只是一个wizzard prodder,所以如果需要

特殊代码,我需要非常明确的帮助。


但是,任何建议都会非常好的接收器。


Chuck

....

I have a macro that saves data to an A: drive. If the drive is empty and I run
the macro, the drive clicks a few times, and a message comes up saying "the
file already exists, do I want to over write it. I figure this is going to be
a neat trick, so I click yes with the drive still empty. A message comes
saying access can''t write to the file. I click OK and a window opens showing
that the macro has failed and gives me a chance to halt it.

I would like to have the macro check to see if there is a floppy inplace before
it tries to write data. I''m only a wizzard prodder, so if this requires
special code, I''ll need very explicit help.

However, any suggestions will be greatfull receiver.

Chuck
....

推荐答案

我的建议是使用VBA而不是宏。使用VBA复制文件

将允许您在错误处理程序中捕获错误,例如

这个


''如果在执行目录时驱动器中没有软盘,则会生成错误52

如果Err.Number = 52那么

msg ="请在A中插入格式化的磁盘:开车! &安培; vbCrLf&

"准备好后单击确定。

RetVal = MsgBox(msg,vbCritical + vbOKCancel,Insert Floppy)

如果RetVal = vbCancel然后恢复清理

恢复TryAgain

结束如果

如果Err.Number = 3026那么

msg ="磁盘已满!请插入一张至少有60k空白空间的软盘。

RetVal = MsgBox(msg,vbCritical + vbOKCancel,插入软盘)

如果RetVal = vbCancel然后恢复清理

恢复TryAgain

结束如果


-

Wayne Morgan

MS Access MVP

" Chuck" <李***** @ schoollink.net>在消息中写道

news:84 ******************************** @ 4ax.com ...
My recommendation would be to use VBA instead of the macro. Copying the file
using VBA will allow you to trap the error in the error handler, such as
this

''Error 52 is generated if no floppy is in the drive when doing a Dir
If Err.Number = 52 Then
msg = "Please insert a formatted disk in the A: drive!" & vbCrLf &
"Click Ok when ready."
RetVal = MsgBox(msg, vbCritical + vbOKCancel, "Insert Floppy")
If RetVal = vbCancel Then Resume CleanUp
Resume TryAgain
End If
If Err.Number = 3026 Then
msg = "Disk is full! Please insert a floppy with at least 60k of empty
space."
RetVal = MsgBox(msg, vbCritical + vbOKCancel, "Insert Floppy")
If RetVal = vbCancel Then Resume CleanUp
Resume TryAgain
End If

--
Wayne Morgan
MS Access MVP
"Chuck" <li*****@schoollink.net> wrote in message
news:84********************************@4ax.com...
我有一个将数据保存到A:驱动器的宏。如果驱动器是空的并且
我运行宏,驱动器会点击几次,并且会出现一条消息,说
文件已经存在,我是否想要覆盖它。我认为这是
是一个巧妙的技巧,所以我点击是,驱动器仍然是空的。一条消息说
说访问不能写入文件。我点击OK然后一个窗口打开
显示宏已经失败并让我有机会停止它。

我想进行宏检查,看看是否有软盘到位在尝试写入数据之前
。我只是一个wizzard prodder,所以如果这需要特殊代码,我需要非常明确的帮助。

然而,任何建议都将是非常好的接收器。

Chuck
...
I have a macro that saves data to an A: drive. If the drive is empty and I run the macro, the drive clicks a few times, and a message comes up saying "the file already exists, do I want to over write it. I figure this is going to be a neat trick, so I click yes with the drive still empty. A message comes
saying access can''t write to the file. I click OK and a window opens showing that the macro has failed and gives me a chance to halt it.

I would like to have the macro check to see if there is a floppy inplace before it tries to write data. I''m only a wizzard prodder, so if this requires
special code, I''ll need very explicit help.

However, any suggestions will be greatfull receiver.

Chuck
...



Chuck< li ***** @ schoollink.net>在消息新闻中写道:< 84 ******************************** @ 4ax.com>。 ..
Chuck <li*****@schoollink.net> wrote in message news:<84********************************@4ax.com>. ..
我有一个将数据保存到A:驱动器的宏。如果驱动器是空的并且我运行了宏,那么驱动器会点击几次,然后会出现一条消息,说
文件已经存在,我是否想要写它。我认为这将是一个巧妙的技巧,所以我点击是,驱动器仍然是空的。一条消息说
说访问不能写入文件。我点击确定,然后会打开一个窗口,显示宏已经失败并让我有机会停止它。

我想进行宏检查以查看是否有软盘到位
之前它试图写数据。我只是一个wizzard prodder,所以如果这需要特殊代码,我需要非常明确的帮助。

然而,任何建议都将是非常好的接收器。

查克
...
I have a macro that saves data to an A: drive. If the drive is empty and I run
the macro, the drive clicks a few times, and a message comes up saying "the
file already exists, do I want to over write it. I figure this is going to be
a neat trick, so I click yes with the drive still empty. A message comes
saying access can''t write to the file. I click OK and a window opens showing
that the macro has failed and gives me a chance to halt it.

I would like to have the macro check to see if there is a floppy inplace before
it tries to write data. I''m only a wizzard prodder, so if this requires
special code, I''ll need very explicit help.

However, any suggestions will be greatfull receiver.

Chuck
...




最近,我一直在努力寻找避免依赖Access的方法''

错误处理程序机制,以便在它们发生之前捕获更多错误。在

http://groups.google.com/groups?hl=e....8D6%40hlp.com


Andrew Kennedy提供了一个汇编语言例程,用于检查软盘驱动器中是否存在磁盘,而不使用中断24.




http://groups.google.com/groups?hl=e...40nntp.crl.com

Weiqi Gao说:


这给我们留下了两个选项:使用assember创建一个dll文件

并从Access Basic调用函数, - OR-- embed _asm {...}在一个

C函数中并将其编译为dll。


有没有人创建过这样一个dll来处理软盘

信息?


谢谢,

James A. Fo rtune



Recently, I have been trying to find ways to avoid relying on Access''
error handler mechanism in an effort to catch more errors before they
happen. In

http://groups.google.com/groups?hl=e....8D6%40hlp.com

Andrew Kennedy gives an assembly language routine to check for the
presence of a disk in the floppy drive without using interrupt 24.

In

http://groups.google.com/groups?hl=e...40nntp.crl.com

Weiqi Gao says:

That leaves us with only two options: create a dll file using assember
and call the functions from Access Basic, --OR-- embed _asm{...} in a
C function and compile it to a dll.

Has anyone created such a dll already that deals with floppy
information?

Thanks,
James A. Fortune


是的,微软有。看看这是否有帮助。它适用于VB但应该可以通过几个小的更改(即

表格中的控件数组)移植到Access。

http://vbnet.mvps.org /index.html?cod...loppyready.htm


-

Wayne Morgan

MS Access MVP

" James Fortune" < JA ****** @ oakland.edu>在留言中写道

新闻:a6 ************************** @ posting.google.c om ...
Yes, Microsoft has. See if this helps. It is for VB but should be able to be
ported to Access with a couple of minor changes (namely the control array on
the form).

http://vbnet.mvps.org/index.html?cod...loppyready.htm

--
Wayne Morgan
MS Access MVP
"James Fortune" <ja******@oakland.edu> wrote in message
news:a6**************************@posting.google.c om...
Chuck< li ***** @ schoollink.net>写在消息
news:< 84 ******************************** @ 4ax.com>。 ..
Chuck <li*****@schoollink.net> wrote in message news:<84********************************@4ax.com>. ..
我有一个将数据保存到A:驱动器的宏。如果驱动器是空的
并且我运行宏,驱动器会点击几次,并且会出现一条消息,说
文件已经存在,我是否想要写它。我认为这是
是一个巧妙的技巧,所以我点击是,驱动器仍然是空的。消息
表示访问无法写入文件。我点击OK然后一个窗口打开
显示宏已经失败并让我有机会停止它。

我想进行宏检查,看看是否有软盘到位在尝试写入数据之前
。我只是一个wizzard prodder,所以如果这需要特殊代码,我需要非常明确的帮助。

然而,任何建议都将是非常好的接收器。

Chuck
...
I have a macro that saves data to an A: drive. If the drive is empty and I run the macro, the drive clicks a few times, and a message comes up saying "the file already exists, do I want to over write it. I figure this is going to be a neat trick, so I click yes with the drive still empty. A message comes saying access can''t write to the file. I click OK and a window opens showing that the macro has failed and gives me a chance to halt it.

I would like to have the macro check to see if there is a floppy inplace before it tries to write data. I''m only a wizzard prodder, so if this requires
special code, I''ll need very explicit help.

However, any suggestions will be greatfull receiver.

Chuck
...



最近,我一直在努力寻找避免依赖Access''
错误处理程序机制的方法在它们发生之前发现更多错误。在



Recently, I have been trying to find ways to avoid relying on Access''
error handler mechanism in an effort to catch more errors before they
happen. In


http://groups.google.com/groups?hl=e....8D6%40hlp.com
Andrew Kennedy给出一个汇编语言例程,用于在不使用中断24的情况下检查软盘驱动器中是否存在磁盘。

http:// groups.google.com/groups?hl=e...40nntp.crl.com
Weiqi Gao说:

这给我们留下了两个选择:创建一个dll文件使用assember
并调用Access Basic中的函数, - OR--在一个
C函数中嵌入_asm {...}并将其编译为一个dll。

有没有人已经创建了这样一个处理软盘
信息的dll?

谢谢,
James A. Fortune


http://groups.google.com/groups?hl=e....8D6%40hlp.com
Andrew Kennedy gives an assembly language routine to check for the
presence of a disk in the floppy drive without using interrupt 24.

In

http://groups.google.com/groups?hl=e...40nntp.crl.com
Weiqi Gao says:

That leaves us with only two options: create a dll file using assember
and call the functions from Access Basic, --OR-- embed _asm{...} in a
C function and compile it to a dll.

Has anyone created such a dll already that deals with floppy
information?

Thanks,
James A. Fortune


这篇关于确定A:驱动器是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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