Delete record from a recordset

jalgier

New member
Local time
Today, 16:18
Joined
Oct 2, 2001
Messages
7
I have been unable to delete a record from a recordset (from a form) using the below code...

Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
Dim Test As String
Dim strSQL As String
Test = Me.MWTicketNo 'form field
rst.Open "SELECT * FROM MantleTicket"
strSQL = "[Ticket No] = " & " ' " & Test & " ' "

With rst
.Find strSQL
.Delete
End With

I get the error "Either EOF or BOF is true, or the current record has been deleted. Requested operation requires a current record."

I want to think the problem is in my concatenation because if I manually enter the value in my select statement, the code works. I have tried a number of different ways, but no success...any ideas?

Thanks
 
What if you tried:

Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
Dim Test As String
Dim strSQL As String
Test = Me.MWTicketNo 'form field
rst.Open "SELECT * FROM MantleTicket where [Ticket No] = '" & Test & "'"

With rst
.Delete
End With


[This message has been edited by jstutz (edited 10-02-2001).]
 

Users who are viewing this thread

Back
Top Bottom