Can't filter a recordset

H

H. Martins

Dim stString As String
Dim rs As DAO.Recordset

'lintLastRecord is a public variable where the key record number
to be found is located

If lintLastRecord = 0 Then 'do nothing
Else
Set rs = DBEngine(0)
(0).OpenRecordset("qryModifListaAssociacoes")
rs.Filter = "lintAssociacoesEEmpresasKMaster=" & If
lintLastRecord

If Not rs.EOF Then
rs.Delete
End If
lintLastRecord = 0 'clears, just in case
End If
rs.Update
rs.Close
Set rs = Nothing

Note: lintAssociacoesEEmpresasKMaster belongs to tblAssocEEmpresas - I
am not sure if I must use:
tblAssocEEmpresas.lintAssociacoesEEmpresasKMaster or
rs.lintAssociacoesEEmpresasKMaster
.... anyway, I tried several hypothesis

Now, if I remove the filter it deletes the fist record, of course.
With the filter, nothing happens

Can I have some help, please?
Henry
 
H

H. Martins

Correction: code is

rs.Filter = "lintAssociacoesEEmpresasKMaster=" &
lintLastRecord

(no 'if' of course - bad paste)

Henry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top