David Emerson
newsgrps at dalyn.co.nz
Mon Jan 14 12:21:16 CST 2013
Rocky,
It may be a paste error but in your second example you have the lines:
Set db = CurrentDb
db.Execute "Delete * FROM tblCompany WHERE CompanyID = " & Me.CompanyID
Me.Requery
DoCmd.RunCommand acCmdDeleteRecord
Me.cboCompanies.Requery
Should the "Me.Requery" be at the end of the db.Execute?
Regards
David Emerson
Dalyn Software Ltd
Wellington, New Zealand
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Tuesday, 15 January 2013 6:52 a.m.
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Error 3188 Could not update; currently locked by another
session on this machine
Dear List:
I have an app generating the subject error when trying to delete a record.
I'm running this locally (FE and BE) and I'm the only one running it.
The previous version of this app does not have the error. So something I
changed in the process of doing the client's latest wish list created it.
I imported the opening form, main menu, and form that throws the error, and
a module of Public functions from the previous version which works and it
still generates the error. So it's not in those forms or module.
(No unfortunately, I did not document each of my changes. :(((( )
the code is pretty simple:
Private Sub cmdDelete_Click()
On Error GoTo IsIt3200:
intReply = MsgBox("Are you absolutely certain that you want to delete this
Company record?", vbYesNo) If intReply = vbNo Then Exit Sub
DoCmd.RunCommand acCmdDeleteRecord
Me.cboCompanies.Requery
Exit Sub
IsIt3200:
If Err.Number = 3200 Then
MsgBox "Company cannot be deleted as it is being used in one or more
Jobs/Bids", vbExclamation
Exit Sub
Else
MsgBox "Error: " & Err.Number & " - " & Err.Description
Call cmdExit_Click
End If
End Sub
trapping the condition if the company PK is an FK in any Job in tblJobs. So
I tried using db.Execute like this:
Private Sub cmdDelete_Click()
On Error GoTo IsIt3200:
intReply = MsgBox("Are you absolutely certain that you want to delete this
Company record?", vbYesNo) If intReply = vbNo Then Exit Sub
Set db = CurrentDb
db.Execute "Delete * FROM tblCompany WHERE CompanyID = " & Me.CompanyID
Me.Requery
DoCmd.RunCommand acCmdDeleteRecord
Me.cboCompanies.Requery
Exit Sub
IsIt3200:
If Err.Number = 3200 Then
MsgBox "Company cannot be deleted as it is being used in one or more
Jobs/Bids", vbExclamation
Exit Sub
Else
MsgBox "Error: " & Err.Number & " - " & Err.Description
Call cmdExit_Click
End If
End Sub
'
Generates no error but doesn't delete the record.
Any ideas what I might have done to break my app?
MTIA
Rocky Smolin
Beach Access Software
858-259-4334
<http://www.bchacc.com> www.bchacc.com < <http://www.bchacc.com/>
http://www.bchacc.com/> <http://www.e-z-mrp.com> www.e-z-mrp.com <
<http://www.e-z-mrp.com/> http://www.e-z-mrp.com/>
Skype: rocky.smolin
--
AccessD mailing list
<mailto:AccessD at databaseadvisors.com> AccessD at databaseadvisors.com
<http://databaseadvisors.com/mailman/listinfo/accessd>
http://databaseadvisors.com/mailman/listinfo/accessd
Website: <http://www.databaseadvisors.com> http://www.databaseadvisors.com