rst.Open "SELECT * FROM Equipas WHERE ([ID - Funcionário] LIKE '" & idfunc & "' AND [ID - Tarefa] LIKE ' " & idtask & "' );", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
rst.Delete adAffectCurrent
rst.Update
rst.Close
I receive the runtime error 3021 however the query is not empty.
Double check that point.
If that version of the code tells you "recordset is empty", go to the Immediate window (Ctrl+g) to examine the
SELECT
statement the code built. You can copy the statement text and paste it into SQL View of a new Access query for testing.My best guess is the query returns no rows because it includes a space just before the value of
idtask
, and no[ID - Tarefa]
values match space plusidtask
: