Rocky Smolin
rockysmolin at bchacc.com
Mon Jan 14 11:51:53 CST 2013
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
www.bchacc.com <http://www.bchacc.com/>
www.e-z-mrp.com <http://www.e-z-mrp.com/>
Skype: rocky.smolin