3624 error when using DoCmd.RunCommand acCmdSaveRecord. Help?

Lili1964

New member
Local time
Yesterday, 19:40
Joined
May 8, 2013
Messages
4
Dear Access expert,

We get an access 3624 error for a long time now. (Cannot read the record. The record is currently used by another user an dis locked.).
We cannot solve it.

We solved it temporary by switching of the referential integrity relationsship.
But is this the right solution?

Can the recordset we used at 1 be of influence?
Or can it be the STRARGS at 2 (we use this instead of using global variables).?
Or
Can it be because of using the code DoCmd.RunCommand acCmdSaveRecord (we tried to replace it with me.dirty = false but this didn't resolve the 3624 error) or Me.Subformulier_Traject_Kinderen.Form.Refresh at 3?

Can someone help?

Code:
1 OPHALEN GEGEVENS UIT DATABASE
_______________________________________________________
Private Sub IntakeKnop_Click()
Dim StrArg As String
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim i As Integer

If Not AanvraagList.Column(0) = 0 Then

strSQL = "SELECT * FROM Aanvraag WHERE AanvraagID = " & AanvraagList.Column(0)
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst

i = 0
Do While i <= 13
If Not i = 13 Then
StrArg = StrArg & rs.Fields(i) & ";"
Else
StrArg = StrArg & rs.Fields(i)
End If
i = i + 1
Loop


rs.Close
db.Close

Set rs = Nothing
Set db = Nothing

DoCmd.OpenForm "Intake2", acNormal, , , acFormAdd, , StrArg
DoCmd.Close acForm, "Aanvraag Opzoeken"
End If
End Sub


2 : FORMULIER LADEN EN DOORGEVEN GEGEVENS DIE BIJ 1 UIT DE DATABASE GEHAALD ZIJN:
____________________________________________
Private Sub Form_Load()

On Error Resume Next

'Exit Sub

If Nz(Me.OpenArgs, "") <> vbNullString Then
StrArgs = Split(Me.OpenArgs, ";")
End If

Me.DatumText.SetFocus
Me.DatumText.Value = Date
OK2Close = False
DoCmd.RunCommand acCmdSaveRecord

Me.Subformulier_NAW.Form.Titel.SetFocus
Me.Subformulier_NAW.Form.Titel.Text = StrArgs(3)
Me.Subformulier_NAW.Form.Voornaam.SetFocus
Me.Subformulier_NAW.Form.Voornaam.Text = StrArgs(4)
Me.Subformulier_NAW.Form.Tussenvoegsels.SetFocus
Me.Subformulier_NAW.Form.Tussenvoegsels.Text = StrArgs(5)
Me.Subformulier_NAW.Form.Achternaam.SetFocus
Me.Subformulier_NAW.Form.Achternaam.Text = StrArgs(6)
Me.Subformulier_NAW.Form.Straat.SetFocus
Me.Subformulier_NAW.Form.Straat.Text = StrArgs(7)
Me.Subformulier_NAW.Form.Huisnummer.SetFocus
Me.Subformulier_NAW.Form.Huisnummer.Text = StrArgs(8)
Me.Subformulier_NAW.Form.[Toevoeging Huisnummer].SetFocus
Me.Subformulier_NAW.Form.[Toevoeging Huisnummer].Text = StrArgs(9)
Me.Subformulier_NAW.Form.Postcode.SetFocus
Me.Subformulier_NAW.Form.Postcode.Text = StrArgs(10)
Me.Subformulier_NAW.Form.Plaatsnaam.SetFocus
Me.Subformulier_NAW.Form.Plaatsnaam.Text = StrArgs(11)
If StrArgs(12) Like "06*" Then
Me.Subformulier_NAW.Form.Mobiel.SetFocus
Me.Subformulier_NAW.Form.Mobiel.Text = StrArgs(12)
Else
Me.Subformulier_NAW.Form.Telefoon.SetFocus
Me.Subformulier_NAW.Form.Telefoon.Text = StrArgs(12)
End If
Me.Subformulier_NAW.Form.[E-mailadres].SetFocus
Me.Subformulier_NAW.Form.[E-mailadres].Text = StrArgs(13)


'Traject werkt beter als er al iets is ingevuld.
Me.Tussenformulier_Traject.Form.ClientID.Visible = True
Me.Tussenformulier_Traject.Form.ClientID.SetFocus
Me.Tussenformulier_Traject.Form.ClientID.Text = Me.Subformulier_NAW.Form.[ClientID]
Me.Tussenformulier_Traject.Form.Problematiek.SetFocus
Me.Tussenformulier_Traject.Form.ClientID.Visible = False

Me.Subformulier_NAW.Form.Voornaam.SetFocus

DoCmd.RunCommand acCmdSaveRecord
Me.Subformulier_NAW.Form.Requery

End Sub

_________________________________________________________
3 CHECKBOX AANVINKEN DAN ONTSTAAT DE3624 error : 

Private Sub HulpvraagCheck_Click()
'On Error Resume Next

'Dim RelatieTotKindStr As String
'Dim WoonsituatieStr As String
'Dim GezagStr As String

'If HulpvraagCheck = True Then
' DoCmd.RunCommand acCmdSaveRecord
' If Not [Relatie tot kind] = "" Then
' RelatieTotKindStr = [Relatie tot kind]
' [Relatie tot kind] = ""
' End If
' If Not [Woonsituatie] = "" Then
' WoonsituatieStr = [Woonsituatie]
' [Woonsituatie] = ""
' End If
' If Not [Gezag] = "" Then
' GezagStr = [Gezag]
' [Gezag] = ""
' End If
' DoCmd.RunCommand acCmdSaveRecord
' Me.Subformulier_Traject_Kinderen.SourceObject = "Subformulier Problematiek Kinderen"
' Me.Subformulier_Traject_Kinderen.LinkMasterFields = "KindID"
' Me.Subformulier_Traject_Kinderen.LinkChildFields = "KindID"

' Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.SetFocus
' Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.Text = RelatieTotKindStr
' Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.SetFocus
' Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.Text = WoonsituatieStr
' Me.Subformulier_Traject_Kinderen.Form.GezagText.SetFocus
' Me.Subformulier_Traject_Kinderen.Form.GezagText.Text = GezagStr
' Me.HulpvraagCheck.SetFocus
'Else
' If Me.Subformulier_Traject_Kinderen.SourceObject = "Subformulier Problematiek Kinderen" Then
' DoCmd.RunCommand acCmdSaveRecord
' If Not Me.Subformulier_Traject_Kinderen.Form.Recordset.RecordCount = 0 Then
' Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.SetFocus
' RelatieTotKindStr = Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.Text
' Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.SetFocus
' WoonsituatieStr = Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.Text
' Me.HulpvraagCheck.SetFocus
' Me.Subformulier_Traject_Kinderen.Form.GezagText.SetFocus
' GezagStr = Me.Subformulier_Traject_Kinderen.Form.GezagText.Text
' Me.Subformulier_Traject_Kinderen.Form.Recordset.Delete
' TrajectText.Visible = True
' TrajectText.SetFocus
' TrajectText.Value = Null
' HulpvraagCheck.SetFocus
' TrajectText.Visible = False
' [Relatie tot kind] = RelatieTotKindStr
' [Woonsituatie] = WoonsituatieStr
' [Gezag] = GezagStr
' End If
' End If
' Me.Subformulier_Traject_Kinderen.SourceObject = "Subformulier NAW Kinderen"
' Me.Subformulier_Traject_Kinderen.LinkMasterFields = "KindID"
' Me.Subformulier_Traject_Kinderen.LinkChildFields = "KindID"
'End If

'On Error GoTo Fout

Dim RelatieTotKindStr As String
Dim WoonsituatieStr As String
Dim GezagStr As String

CheckBln = True
If HulpvraagCheck = True Then
Me.Subformulier_Traject_Kinderen.Form.Refresh
DoCmd.RunCommand acCmdSaveRecord
If Not [Relatie tot kind] = "" Then
RelatieTotKindStr = [Relatie tot kind]
[Relatie tot kind] = ""
End If
If Not [Woonsituatie] = "" Then
WoonsituatieStr = [Woonsituatie]
[Woonsituatie] = ""
End If
If Not [Gezag] = "" Then
GezagStr = [Gezag]
[Gezag] = ""
End If
DoCmd.RunCommand acCmdSaveRecord
Me.Subformulier_Traject_Kinderen.SourceObject = "Subformulier Problematiek Kinderen"
Me.Subformulier_Traject_Kinderen.LinkMasterFields = "KindID"
Me.Subformulier_Traject_Kinderen.LinkChildFields = "KindID"

Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.SetFocus
Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.Text = RelatieTotKindStr
Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.SetFocus
Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.Text = WoonsituatieStr
Me.Subformulier_Traject_Kinderen.Form.GezagText.SetFocus
Me.Subformulier_Traject_Kinderen.Form.GezagText.Text = GezagStr
Me.HulpvraagCheck.SetFocus
DoCmd.RunCommand acCmdSaveRecord
Me.Subformulier_Traject_Kinderen.Form.Refresh
Else
If Me.Subformulier_Traject_Kinderen.SourceObject = "Subformulier Problematiek Kinderen" Then
Me.Subformulier_Traject_Kinderen.Form.Refresh
DoCmd.RunCommand acCmdSaveRecord
Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.SetFocus
If Not Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.Text = "" Then
RelatieTotKindStr = Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.Text
Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.Text = ""
End If
Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.SetFocus
If Not Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.Text = "" Then
WoonsituatieStr = Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.Text
Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.Text = ""
End If
Me.Subformulier_Traject_Kinderen.Form.GezagText.SetFocus
If Not Me.Subformulier_Traject_Kinderen.Form.GezagText.Text = "" Then
GezagStr = Me.Subformulier_Traject_Kinderen.Form.GezagText.Text
Me.Subformulier_Traject_Kinderen.Form.GezagText.Text = ""
End If
If Not Me.Subformulier_Traject_Kinderen.Form.Recordset.RecordCount = 0 Then
Me.Subformulier_Traject_Kinderen.Form.Recordset.Delete
End If
TrajectText.Visible = True
TrajectText.SetFocus
TrajectText.Value = Null
Me.HulpvraagCheck.SetFocus
TrajectText.Visible = False

Me.Subformulier_Traject_Kinderen.SourceObject = "Subformulier NAW Kinderen"
Me.Subformulier_Traject_Kinderen.LinkMasterFields = "KindID"
Me.Subformulier_Traject_Kinderen.LinkChildFields = "KindID"

Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.SetFocus
Me.Subformulier_Traject_Kinderen.Form.RelatieTotKindText.Text = RelatieTotKindStr
Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.SetFocus
Me.Subformulier_Traject_Kinderen.Form.WoonsituatieText.Text = WoonsituatieStr
Me.Subformulier_Traject_Kinderen.Form.GezagText.SetFocus
Me.Subformulier_Traject_Kinderen.Form.GezagText.Text = GezagStr
Me.Subformulier_Traject_Kinderen.Form.Refresh
End If
End If
DoCmd.RunCommand acCmdSaveRecord
CheckBln = False
Exit Sub

Fout:
If Err.Number = 3200 Then
MsgBox ("Er staan één of meer voortgangen onder het traject van dit kind, en deze mag daarom niet worden verwijderd.")
HulpvraagCheck = True
Else
MsgBox ("Fout " & Err.Number & vbCrLf & Err.Description)
End If
CheckBln = False
End Sub


Private Sub Knop29_Exit(Cancel As Integer)
On Error Resume Next
If TempVars.Item(TabControl) = True Then
If Screen.ActiveForm.Name = "Intake2" Then
Forms!Intake2.Form.Hoe_in_Contact.SetFocus
End If
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom