I am using the following to create a connection to an Access Db file via the Workbook_Open procedure in ThisWorkbook
In a module I have
to set the connection variable to span all modules, userforms, etc
I am then adding new records to the Db which executes as expected the majority of the time but sometimes the connection is lost and I'm wondering if there is a default timeout period for the connection?
Sometimes I can add a new record, but I also have an amend process that finds a record, populates a userform with the record details and then I want that already open record to be updated but at the point of amending the record
The connection has been lost which I am assuming is because of a timeout and as I'm stepping through the code for development it's taking a while to get to the point of amending the record.
TIA
Code:
Set cnConnection = CreateObject("ADODB.Connection")
strDbName = ThisWorkbook.Path & "\" & strDbFile
cnConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDbName
Code:
Public cnConnection As ADODB.Connection
I am then adding new records to the Db which executes as expected the majority of the time but sometimes the connection is lost and I'm wondering if there is a default timeout period for the connection?
Sometimes I can add a new record, but I also have an amend process that finds a record, populates a userform with the record details and then I want that already open record to be updated but at the point of amending the record
Code:
rsDriver.Fields("Surname") = strSurname
rsDriver.Fields("First_Name") = strFirstName
rsDriver.Fields("Location") = strLocation
etc
etc
TIA