Finding new record after requery

  • Thread starter Thread starter Chris Kennedy
  • Start date Start date
C

Chris Kennedy

I am using a access adp project in Access 2000. I want to be able to delete
a record,
requery the form and then make it go to the next record after the one
deleted. I have tried using bookmarks:

varAccount ID is the value of the primary key of the next record

Me.Requery
Dim rst As ADODB.Recordset
strCriteria = "[AccountID] = " & varAccountID & ""
Set rst = Me.RecordsetClone
rst.Find strCriteria
Me.Bookmark = rst.Bookmark
Set rst = Nothing

When I do this I get an error 3021 saying BOF or EOF is true

Alternatively I have tried using the find record method. Going to the next
record getting the value of the primary key, requerying the form, then
finding the record of the next record. But it won't find the record after
the requery, it just stays on the first record.

Any ideas? Regards.
 
Hi,
It sounds like like you're not getting a match on the FindFirst.

Try this:
strCriteria = "[AccountID] = " & varAccountID

and see what happens. Also, step through your code to see the value of
varAccountID.
 
Hi,

Unforunately the Me.Recorsource clone becomes invalid
after a record is added to or deleted from a form after it
has been opened[unless you cahnge the recordsource of the
form.]

So try the following

--Assume record has now been deleted.

me.recordsource = Null
me.recordsource = <<Your Data Source">>

''Should not be required >Me.Requery
 
Back
Top