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
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