Finding new record after requery

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.
 
D

Dan Artuso

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.
 
P

Peter

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
 

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