i have the following code which i cant get working

i think i have the SQL correct but dont exactly know where i am going with the execution.

Please help(the error i get is operation is not allowed when object is closed)

lastball i a variable that hold the value of a row(primary key)



strSQL1 = "DELETE FROM Ball" & _
" WHERE BallNo =" & LastBall

Set rsBall = New ADODB.Recordset
rsBall.Open strSQL1, conn, adOpenDynamic, adLockOptimistic

rsBall.Delete

rsBall.Close
Set rsBall = Nothing

Many thanks