The heading is translated from a error message in norwegian which comes when users are trying to registrer to a table in access using this code:
When i try to access the table manually and i try to make a new post i also get the error message
The code has been working fine for 96 000 rows in the table, but lately when both reading and writing to the table has increased the error message has come from time to time
The way i solve it is to make a copy of the database and make all the users log on to the copy and then it works fine again
I also use the code
for different calculating jobs and other things and my first hunch here is that this code somewhat locks the table till it is finished with it's job. Hmm.. I need to fix this quick
Code:
Function registrere_lokasjonshistorikk(Varenr As String, antall_tabletter As Integer, Fra As String, til As String, Optional Gembaloksum As Long, Optional MudaLoksum As Long, Optional Hendelse As String, Optional Behandlingstype As String, Optional Boksnr As Long, Optional Pakkealternativ As String)
Init_Globals
ntlogin = Environ("Username")
Dim rst As New ADODB.Recordset
rst.Open "SELECT * From [tbl lokasjonsflytthistorikk]", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
With rst
.AddNew
!Varenr = Varenr
![antall tabletter] = antall_tabletter
![Fra lokasjon] = Fra
![til lokasjon] = til
If Not IsNull(Gembaloksum) Then
![Sum Gemba] = Gembaloksum
End If
If Not IsNull(MudaLoksum) Then
![Sum Muda] = MudaLoksum
End If
If Not IsNull(Hendelse) Then
!Hendelse = Hendelse
End If
If Not IsNull(Behandlingstype) Then
![Behandlingstype] = Behandlingstype
End If
If !autonr = 100000 Then
MsgBox "*", vbOKOnly, "**"
End If
If Not IsNull(Pakkealternativ) Then
!Pakkealternativ = Pakkealternativ
End If
If Not IsNull(Boksnr) Then
!Boksnr = Boksnr
End If
![rettet av] = ntlogin
![Rettet tid] = Now
.Update
.Close
End With
Set rst = Nothing
End Function
The code has been working fine for 96 000 rows in the table, but lately when both reading and writing to the table has increased the error message has come from time to time
The way i solve it is to make a copy of the database and make all the users log on to the copy and then it works fine again
I also use the code
Code:
rst.Open "SELECT * From [tbl lokasjonsflytthistorikk]", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Comment