Hi all and again thank you,
I have tried both these methods with the first method It works except I get this Write Conflict?
With second Method the FirstsSQL= I get a debug two few parameters, expected 1
The second sSQL works, The Third and 4th sSQL I get the same Write Conflict?
Posted Coade below and photo of write conflicts
First Method
Code:
Private Sub ChkIsActive_Click()
If ChkIsActive = False Then
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblAccount SET IsActive = 0 WHERE tblAccount.AcctHolderID=" & Me.AccountHolderID
DoCmd.RunSQL "UPDATE tblAccount SET RecordLock = True WHERE tblAccount.AcctHolderID=" & Me.AccountHolderID
DoCmd.RunSQL "UPDATE tblAccountDetail SET RecordLock = True WHERE tblAccountDetail.AccountHolderID=" & Me.AccountHolderID
DoCmd.RunSQL "UPDATE tblAccountDetail SET AccountClosed = Now() WHERE tblAccountDetail.AccountHolderID=" & Me.AccountHolderID
DoCmd.SetWarnings True
Me.ChkRecordLock = True
Me.TxtAccountHolder.SetFocus
Else
Me.ChkRecordLock = False
Me.TxtAccountHolder.SetFocus
End If
Call Form_Current
End Sub
Second Method
Code:
Private Sub ChkIsActive_Click()
Dim sSQl As String
If ChkIsActive = 0 Then
If MsgBox("Make account inactive?", vbYesNo) = vbNo Then Exit Sub
sSQl = "UPDATE tblAccount SET IsActive = 0 WHERE tblAccount.AccountHolderID=" & Me.AccountHolderID
'sSQl = "UPDATE tblAccount SET RecordLock = True WHERE tblAccount.AcctHolderID=" & Me.AccountHolderID
'sSQl = "UPDATE tblAccountDetail SET RecordLock = True WHERE tblAccountDetail.AccountHolderID=" & Me.AccountHolderID
'sSQl = "UPDATE tblAccountDetail SET AccountClosed = Now() WHERE tblAccountDetail.AccountHolderID=" & Me.AccountHolderID
CurrentDb.Execute sSQl, dbFailOnError
Me.Refresh
End If
Me.ChkRecordLock = True
Me.TxtAccountHolder.SetFocus
Call Form_Current
End Sub
I dont know why this wont work?
Dave