Re: Access Crashes with ADO Delete Record Command
- From: "Henning" <computer_hero@xxxxxxxxxxxx>
- Date: Fri, 5 Jan 2007 01:48:23 +0100
I'm not an expert, but they will be here as soon as they find you (Ado quest
in Dao grp)
Inline comment
"jamie" <jamiedora@xxxxxxxxx> skrev i meddelandet
news:1167932116.570582.309290@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
To anyone who can help:If rst.BOF Or rst.EOF Then Exit Sub
I have a form, in data*** view, I wrote code (in ADO), listed below,
to delete a given record. The code is placed in a module, and called
by simmilar forms. For this paticular form, when I initate the code,
the record is deleted and the application crashses (shuts down without
warning). The table is linked.
When I execute the command in debug mode, the following error (Record
Is Deleted, 3167) is recieved, when I press end the application ends.
When I bypass the requerry cmd, and refresh the form mannually, I get
the same error.
Thus far, I have tried to compact/repair both tables; rebuild the form,
rebuild the table. I even deleted all table relationships.
For all my attempts, I have had no luck. - Thanks in advance, to anyone
who can assit
'***** Code Snipit *****
Dim db As ADODB.Connection
Dim rst As ADODB.Recordset
Dim rst2 As ADODB.Recordset
Dim msgResult, ItemCurrent As Long
Dim lngRelatedID As Variant
'-- Constants --
SQLCodeA = "SELECT CB_MaterialProject.ID " _
& "From CB_MaterialProject " _
& "WHERE CB_MaterialProject.ID = " & intID
'-- Objects --
Set db = CurrentProject.Connection
Set rst = New ADODB.Recordset
DoCmd.close acForm, strFormName, acSaveNo 'Close form to avoid errors
'-- Open Database --
rst.Open SQLCodeA, db, adOpenKeyset, adLockOptimistic
If rst.EOF Then Exit Sub
msgResult = MsgBox("Do you wish to delete Item ?", vbInformation +/Henning
vbYesNo)
If msgResult = vbYes Then
rst.Delete (adAffectCurrent)
rst.Update
rst.close
end If
me.requery '!!!!!!!!!!!!!! Code fails here
.
- References:
- Access Crashes with ADO Delete Record Command
- From: jamie
- Access Crashes with ADO Delete Record Command
- Prev by Date: Access Crashes with ADO Delete Record Command
- Next by Date: Re: Access Crashes with ADO Delete Record Command
- Previous by thread: Access Crashes with ADO Delete Record Command
- Next by thread: Re: Access Crashes with ADO Delete Record Command
- Index(es):
Loading