Excel crashes when I try access Access DB



When I my code runs the following code Excel abruptly closes.

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 

References in Excel VBA are as follows

Visual Basic For Applications

Microsoft Excel 15.0 Object Library

OLE Automation

Microsoft Office 15.0 Object Library

Microsoft ActiveX Data Objects 6.1 Library

Microsoft Scripting Runtime

Microsoft DAO 3.6 Object Library

Both Excel and Access are 64-Bit

I have run this program on a computer with MS Excel and Access 2016 and it works. Any suggestions as to how to solve Excel crashing. Thanks.

Edit: Using Event viewer as suggested in the comments I have the following errors

Faulting application name: EXCEL.EXE, version: 15.0.5045.1000, time stamp: 0x5b0d303b
Faulting module name: mso.dll, version:, 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: 


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

Problem signature:
P2: 15.0.5045.1000
P3: 5b0d303b
P4: mso.dll
P6: 5b1fa456
P7: c0000005
P8: 00000000005b0e04

Attached files:

These files may be available here:

Analysis symbol: 
Rechecking for solution: 0
Report Id: 7450046f-8670-463f-b15f-48faccf15016
Report Status: 2147487744
Hashed bucket: 2c96ba3a635c42dce1ba0b040a72d27a
Cab Guid: 0
asked on Stack Overflow Aug 9, 2018 by Tolure • edited Jul 7, 2020 by Martijn Pieters

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0