Opening recordsets (DAO or ADO)

trab

Registered User.
Local time
Today, 02:42
Joined
Feb 10, 2014
Messages
20
I have a form based on an underlying query in a .mdb database. I want to be able to navigate backwards and forwards in the form using .movenext and .moveprevious etc.

Which sort of recordset should I use? I've seen discussions about ADO and DAO, and have come across the term "forward-only", which I'd not been aware of before.

Having made the choice, what is the correct syntax for opening the appropriate recordset, and also for .movenext and .moveprevious etc?
 
I'll not ask why, but try using the below.
Code:
Me.Recordset.MoveNext
 
why not add navigation buttons, and use them to navigate records. much easier than trying to duplicate the functionality.
 
Basically, what I'm trying to do is mimic a floating toolbar I had in Access 2000 (I'm currently using 2007). As you will know, custom toolbars are no longer available in 2007, so I've designed a form with a number of icons, to move forwards or backwards a given no of records, or to "ditto" a field value down a given number of records.

If I say

Dim mydB As Database, rst As DAO.Recordset
Set mydB = CurrentDb()
Set rst = mydB.OpenRecordset("rstTransactions", dbOpenDynaset)

Me.Recordset.Moveprevious
etc. following jdraw's see link

or even

rst.Moveprevious
etc.

Access appears to ignore that line.
 
If you open the recordset, it will open at the first record---there is NO PREVIOUS RECORD.
You have to be aware of where you are in the recordset.

If you are at Beginning, there is no previous; if you are at the end, there is no Move Next.

I found this with Google.
http://www.databasedev.co.uk/form_navigation_buttons.html
 
Last edited:
Thanks for the link jdraw.

I've got round the problem using DoCmd.GoToRecord.

This appears to work, but I don't know whether it's good programming.
 

Users who are viewing this thread

Back
Top Bottom