访问崩溃当我关闭表单时 [英] Access Crashes When I close a form
问题描述
我有一个从Access 2003转换的Access 2007数据库。 它已经使用了大约10年,工作正常。
I have an Access 2007 DB that was converted from Access 2003. Its been in use for about 10 years, working fine.
我有一个名为Issued_Parent_Form的表单。 它上面有一个名为"MainMenu"的命令按钮。 它过去只是关闭Issued_Parent_Form并返回仍然打开的MainMenu表单。 (主菜单
表单上有一个按钮,用于打开Issued_Parent_Form。)
I have a form named Issued_Parent_Form. There is a command button on it named "MainMenu". It used to simply close the Issued_Parent_Form and go back to the MainMenu form which is still open. (There is a button on the main menu form that opens Issued_Parent_Form.)
Issued_Parent_Form"MainMenu"的点击事件中的代码。命令按钮出现在下面。
The code in the on click event of the Issued_Parent_Form "MainMenu" command button appears below.
Private Sub MainMenu_Click()
On Error GoTo Err_MainMenu_Click
如果Me.JobLot<> ""然后
DoCmd.RunMacro"计算"
结束如果是
'MsgBox'单击确定继续"
$
DoCmd.Close acForm,"Issued_Parent_Form"&
退出Sub¥
Err_MainMenu_Click:
$
MsgBox Err.Description
完成:
结束次
Private Sub MainMenu_Click()
On Error GoTo Err_MainMenu_Click
If Me.JobLot <> "" Then
DoCmd.RunMacro "Calculate"
End If
'MsgBox "Click OK to Continue"
DoCmd.Close acForm, "Issued_Parent_Form"
Exit Sub
Err_MainMenu_Click:
MsgBox Err.Description
Done:
End Sub
有时我会 看到一个空白的msgbox,然后是下面的消息。 有时我看不到msgbox,它会回到主菜单屏幕,然后当我点击另一个命令按钮时,它会崩溃。
Sometimes I see a blank msgbox, then the message below. Sometimes I see no msgbox, it goes back to the main menu screen and then when I click another command button, it crashes.
当我点击MainMenu按钮时Access显示以下消息并退出工作。
When I click the MainMenu button Access shows the following message and quits working.
即使我退出;
如果Me.JobLot<> ""然后
DoCmd.RunMacro"计算"
结束如果
If Me.JobLot <> "" Then
DoCmd.RunMacro "Calculate"
End If
它仍然是错误。
有任何建议吗? (没有近距离事件或类似事件,非常直截了当。
Any suggestions? (There are no on close events or anything like that, pretty straight forward.
推荐答案
hi tkosel,
hi tkosel,
我在A2003中遇到了同样的问题(现在使用A2013)。我使用VB脚本启动我的数据库。打开记事本并粘贴脚本并更改数据库的名称并将其保存为".vbs"扩展名。
I had the same problem in A2003 (now using A2013). I use a VB Script to start my database. Open Notepad and paste the script and change the name of you database and save it as '.vbs' extension.
----------------------------------
----------------------------------
期权明确
Dim MSAccPath
Dim RegKey
Dim WSHShell
Dim currentDirectory
Option Explicit
Dim MSAccPath
Dim RegKey
Dim WSHShell
Dim currentDirectory
'获取MSACCESS.exe目录
RegKey =" HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \\\\\\\\\\\\\\\ >
&" CurrentVersion\App Paths \ MSACCESS.EXE \ Path"
设置WSHShell = WScript.CreateObject(" WScript.Shell" )
' Get MSACCESS.exe directory
RegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\" _
& "CurrentVersion\App Paths\MSACCESS.EXE\Path"
Set WSHShell = WScript.CreateObject("WScript.Shell")
'获取父目录
MSAccPath = WSHShell.RegRead(RegKey)
currentDirectory = WSHShell.CurrentDirector y
' Get parent directory
MSAccPath = WSHShell.RegRead(RegKey)
currentDirectory = WSHShell.CurrentDirectory
'反编译
WSHShell.Run Chr(34)& MSAccPath& " MSACCESS.EXE" &安培; Chr(34)& " " &安培; Chr(34)& currentDirectory& " \Test.accdb" &安培; Chr(34)& " / decompile"
' Decompile
WSHShell.Run Chr(34) & MSAccPath & "MSACCESS.EXE" & Chr(34) & " " & Chr(34) & currentDirectory & "\Test.accdb" & Chr(34) & " /decompile"
'Clear shell var
设置WSHShell = Nothing
' Clear shell var
Set WSHShell = Nothing
--------- ---------
------------------
希望这对您有帮助。
这篇关于访问崩溃当我关闭表单时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!