Question Access 2007 Database Keeps Closing

rajeshsarin

Registered User.
Local time
Tomorrow, 03:08
Joined
Sep 25, 2009
Messages
50
Hi All,

I have three access 2007 databases that used to work just fine till we upgraded from Office 2007 to Office 2013.

Now on certain occasions when we hit some buttons (that have got some macro or VB procedure behind the buttons), the databases just closes itself.

I have checked again by running the database in 2007 and it works fine, but in Office 2013 it crashes.

Any help would be appreciated.

Regards - Raj

The Button is called Create Invoice and on click the event procedure runs that has the following code behind it

Private Sub Create_Invoices_Click()
Dim rs As DAO.Recordset
Dim InvoiceNo As Long
Dim prnt As [Form_Student Data]
Dim offr As Form_Offer
10 On Error GoTo Error_Handler
20 Set rs = CurrentDb.OpenRecordset("Invoice", dbOpenDynaset)
30 rs.AddNew
40 InvoiceNo = rs!InvoiceNo
50 rs!Inv_Date = Date
60 rs!Offer_ID = Me.[Offer ID]
70 rs!Inv_Due = Date + 15
80 rs!Inv_Staff = GetStaffName
90 rs.Update
100 DoCmd.OpenForm "Invoice", acNormal, , , , acDialog, InvoiceNo
110 On Error GoTo 0: Exit Sub
120 Error_Handler: Select Case fErrorHandler(err.Number, Erl, err.Description, "VBA Document Form_AcctsOffer", "Create_Invoices_Click"): Case vbRetry: Stop: Resume 0: Case vbIgnore: Resume Next: End Select
End Sub
 
I'm surprised this works in 2007 and not 2013 - line 40 seems to be the problem, which would be a problem for 2007 as well
 
I'm surprised this works in 2007 and not 2013 - line 40 seems to be the problem, which would be a problem for 2007 as well

The code has worked fine in Access 2007 Database for last 8 years, its only when we migrated to Office 2013 we started to have these issues.

Do you think there might be an issue with an Add On or a version of VB Script or Some Item in the library?

We had similar issues when we installed Adobe DC version, it just wouldn't work, so we had to revert to Acrobat 9 and the problem was fixed

Regards - Raj
 
You need to comment out the error handling so it will break and show the actual line that is failing.

Then comment out parts of the code until it runs without crashing.

I'm surprised this works in 2007 and not 2013 - line 40 seems to be the problem, which would be a problem for 2007 as well

Why do you say that? It is simply reading the field from the recordset. Presumably it is an autonumber field.

Maybe the autonumber seed has corrupted so it can't make a new record.
However this should throw an error rather than crashing.
 
Last edited:
Why do you say that? It is simply reading the field from the recordset
My thinking was because the recordset is a new one and no value has been assigned, you would be trying to assign null or empty - but I hadn't thought of it being an autonumber. Won't get into that debate:)
 

Users who are viewing this thread

Back
Top Bottom