当我尝试访问Access DB

时间:2018-08-09 23:13:32

标签: excel-vba excel-2013 ms-access-2016

症状:

当我的代码运行以下代码时,Excel突然关闭。

Private Sub OpenConnection()

   If Not (DBCon.State And adStateOpen) = adStateOpen Then DBCon.Open "Provider = Microsoft.ACE.OLEDB.12.0; data source=C:\Users\bissonp\Desktop\ai\ai2.accdb;"

End Sub 

Excel VBA中的引用如下

  

应用程序的Visual Basic

     

Microsoft Excel 15.0对象库

     

OLE自动化

     

Microsoft Office 15.0对象库

     

Microsoft ActiveX数据对象6.1库

     

Microsoft脚本运行时

     

Microsoft DAO 3.6对象库

Excel和Access均为64位

我已经在装有MS Excel和Access 2016的计算机上运行了该程序,并且可以运行。关于如何解决Excel崩溃的任何建议。谢谢。

编辑:按照评论中的建议使用事件查看器,我遇到以下错误

Faulting application name: EXCEL.EXE, version: 15.0.5045.1000, time stamp: 0x5b0d303b
Faulting module name: mso.dll, version: 0.0.0.0, time stamp: 0x5b1fa456
Exception code: 0xc0000005
Fault offset: 0x00000000005b0e04
Faulting process id: 0x4f00
Faulting application start time: 0x01d4305c562934ce
Faulting application path: C:\Program Files\Microsoft Office\Root\Office15\EXCEL.EXE
Faulting module path: C:\Program Files\Common Files\Microsoft Shared\Office15\mso.dll
Report Id: 7450046f-8670-463f-b15f-48faccf15016
Faulting package full name: 
Faulting package-relative application ID: 

AND

Fault bucket 1277345556296028794, type 4
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: EXCEL.EXE
P2: 15.0.5045.1000
P3: 5b0d303b
P4: mso.dll
P5: 0.0.0.0
P6: 5b1fa456
P7: c0000005
P8: 00000000005b0e04
P9: 
P10: 

Attached files:
\\?\C:\Users\pasca\AppData\Local\Temp\1828426875.cvr
\\?\C:\Users\pasca\OneDrive\Desktop\ai\ai2.xlsm
\\?\C:\Users\pasca\AppData\Local\Temp\CVR6E26.tmp.cvr
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER9584.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER95A4.tmp.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER95C3.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER95E3.tmp.txt

These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_EXCEL.EXE_274d175a8bce6eaa415e2ad0764c80f2fd668880_00000000_748b9a18

Analysis symbol: 
Rechecking for solution: 0
Report Id: 7450046f-8670-463f-b15f-48faccf15016
Report Status: 2147487744
Hashed bucket: 2c96ba3a635c42dce1ba0b040a72d27a
Cab Guid: 0

0 个答案:

没有答案