Code:
Me.txtQtedemande.SetFocus
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End Sub
The rule I was taught eons ago is:
If you create it (an object), destroy it. (you create it by using the "SET" keyword)
If you open it (an object), close it. (you open a recordset using the "OpenRecordset" keyword)
Since you didn't (and don't) OPEN "db", you shouldn't close it. Think about it. You have to open a recordset to see the records, but you never open the "database".
BTW, when declaring the variables, you should have
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset