formerTexan
Programmer
Greetings,
I hope someone can offer suggestions as to why the following error is raised(aside from the obvious: running on a non-2010 version)?
Error 3856: The Microsoft Office Access database cannot update the data in tblNextNumber. The minimum required version to update the data is 14.0.0000.0000.
An accdb database was created in 2010 with a 2007 default format and isn't using any 2010 functionality. No protests were raised when saving back to a 2003 version and I can't duplicate the error using A2010. However users with the accdb version running on an Access 2007 installation encountered the error.
The table (tblnextNumber) is a standard, non-version specific table. The relevant function is below and it is called from a from BeforeUpdate event
Thanks much
formertexan
I hope someone can offer suggestions as to why the following error is raised(aside from the obvious: running on a non-2010 version)?
Error 3856: The Microsoft Office Access database cannot update the data in tblNextNumber. The minimum required version to update the data is 14.0.0000.0000.
An accdb database was created in 2010 with a 2007 default format and isn't using any 2010 functionality. No protests were raised when saving back to a 2003 version and I can't duplicate the error using A2010. However users with the accdb version running on an Access 2007 installation encountered the error.
The table (tblnextNumber) is a standard, non-version specific table. The relevant function is below and it is called from a from BeforeUpdate event
Code:
Public Function pfNextNumber() As Long
Const LOCK_RETRY_MAX = 10
Const LOCK_ERRORS = "Record can't be saved at this time. Do you want to try again?"
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim lngOld As Long
Dim lngNew As Long
Dim iLock As Integer
On Error GoTo pfNextNumber_Err
Set db = CurrentDb
iLock = 0
DoCmd.SetWarnings False
' another user could come in, make concurrent changes and bugger up the system
' therefore to preclude conflicts table access is denied to other users while recordset is open
Set rs = db.OpenRecordset("qryNextNumber", dbDenyRead)
With rs
If Not .BOF And Not .EOF Then
lngOld = !NextNumber
lngNew = lngOld + 1
.Edit
!NextNumber = lngNew
.Update
pfNextNumber = lngNew
End If
End With
DoCmd.SetWarnings True
pfNextNumber_Exit:
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Exit Function
pfNextNumber_Failed: '
' -333 will designate a failed function operation
' and must be handled outside this function by terminating the addition of a new record
pfNextNumber = -333
GoTo pfNextNumber_Exit:
pfNextNumber_Err:
Select Case Err ' if data has been changed, refresh the recordset and try again.
Case 3197: rs.Requery
Resume
Case 3167: ' if record is deleted
MsgBox "Operation has failed! Notify administrator that autonumber function is broke.", vbOKOnly
Resume pfNextNumber_Failed
Case 3260: ' another user has locked the table
iLock = iLock + 1
If iLock < LOCK_RETRY_MAX Then ' if still less than the allotted attempts, try again
Resume
Else ' we are over the limit for attempts at accessing the table
MsgBox "LOCK_ERRORS! This record remains locked by another user and is unavailable", vbOKOnly
Resume pfNextNumber_Failed
End If
Case Else
MsgBox "Error " & Err & ": " & Error
Resume pfNextNumber_Failed
End Select
Thanks much
formertexan