I've tried to combine several macros in order to simplify the updating of a table in Access. When I run the macro, I get the following error message:
Run-time error '3052':
File sharing lock count exceeded. Increase MaxLocksPerFile registry entry.
I am very new with Vb code so I may have made some basic errors. Would someone please look at the code and find out where I went wrong?
Option Compare Database
Const MAIN_TABLE_NAME = "Shell"
Dim dbMain As DAO.Database
Dim rsMain As DAO.Recordset
Function UpdateShell()
Dim strTemp As String
Dim dblTemp As Double
Dim boolTemp As Boolean
Set dbMain = CurrentDb
Set rsMain = dbMain.OpenRecordset(MAIN_TABLE_NAME, dbOpenDynaset)
rsMain.MoveFirst
Do While Not rsMain.EOF
rsMain.Edit
SignFix "DAY_SUP_PD"
SignFix "QTY_PD"
AllFix "paid", 2
AllFix "copay", 2
AllFix "deduct", 2
AllFix "ingcost", 2
AllFix "ingpaid", 2
AllFix "dispfee", 2
AllFix "OVR_MAX", 2
AllFix "MAC_PEN", 2
AllFix "U&C_AMT", 2
rsMain.Update
rsMain.MoveNext
Loop
rsMain.Close
End Function
Sub AllFix(fieldName As String, intFactor As Integer)
SignFix fieldName
DecimalFix fieldName, intFactor
End Sub
Sub SignFix(fieldName As String)
Dim signFieldName As String
signFieldName = CLM_ST
If rsMain.Fields("CLM_ST") = "S" Then
rsMain.Fields(fieldName) = -1 * rsMain.Fields(fieldName)
End If
End Sub
Sub DecimalFix(fieldName As String, intFactor As Integer)
rsMain.Fields(fieldName) = rsMain.Fields(fieldName) / (10 ^ intFactor)
End Sub
If there is anyone that can help, I would greatly appreciate it.
Brian
Run-time error '3052':
File sharing lock count exceeded. Increase MaxLocksPerFile registry entry.
I am very new with Vb code so I may have made some basic errors. Would someone please look at the code and find out where I went wrong?
Option Compare Database
Const MAIN_TABLE_NAME = "Shell"
Dim dbMain As DAO.Database
Dim rsMain As DAO.Recordset
Function UpdateShell()
Dim strTemp As String
Dim dblTemp As Double
Dim boolTemp As Boolean
Set dbMain = CurrentDb
Set rsMain = dbMain.OpenRecordset(MAIN_TABLE_NAME, dbOpenDynaset)
rsMain.MoveFirst
Do While Not rsMain.EOF
rsMain.Edit
SignFix "DAY_SUP_PD"
SignFix "QTY_PD"
AllFix "paid", 2
AllFix "copay", 2
AllFix "deduct", 2
AllFix "ingcost", 2
AllFix "ingpaid", 2
AllFix "dispfee", 2
AllFix "OVR_MAX", 2
AllFix "MAC_PEN", 2
AllFix "U&C_AMT", 2
rsMain.Update
rsMain.MoveNext
Loop
rsMain.Close
End Function
Sub AllFix(fieldName As String, intFactor As Integer)
SignFix fieldName
DecimalFix fieldName, intFactor
End Sub
Sub SignFix(fieldName As String)
Dim signFieldName As String
signFieldName = CLM_ST
If rsMain.Fields("CLM_ST") = "S" Then
rsMain.Fields(fieldName) = -1 * rsMain.Fields(fieldName)
End If
End Sub
Sub DecimalFix(fieldName As String, intFactor As Integer)
rsMain.Fields(fieldName) = rsMain.Fields(fieldName) / (10 ^ intFactor)
End Sub
If there is anyone that can help, I would greatly appreciate it.
Brian