I am working on a datbase project at college using a DAO data control to move through a recordset(Dynaset). I am required to return (after update) to the location I am at when I add or edit a record. I set the bookmark but this does not seem to register or more precisely it always seem to register at the first record. I assume that moving through the recordset with the data control is not changing the current record. Any help would be appreciated.
Many thanks.
23-05-2002 at 09:26 PM
|
JLRodgers Level: Moderator Registered: 04-04-2002 Posts: 1617
Re: Data Control & Bookmarks (DAO) Archived to Disk
Is rs.AbsolutePosition able to return the info you need?
When you move through the recordset (ie: rs.MoveNext) the current record does change, likewise it does with the control.
Re: Re: Data Control & Bookmarks (DAO) Archived to Disk
I have used this in the delete record part of the program but can't use it on the edit or add sections. The specification calls for the recordset to be refreshed after adding/editing records which then places the new record in it's sorted position in the database. This may move the position of the original record by one.
23-05-2002 at 09:44 PM
|
JLRodgers Level: Moderator Registered: 04-04-2002 Posts: 1617
Re: Data Control & Bookmarks (DAO) Archived to Disk
Since I'm assuming that you have to show all the records, and just return to the one that was modified, some of my normal methods won't work.
Are you allowed to loop thru the data until you reach it?
.MoveFirst
Do until .Fields("Whatever") = ID
.MoveNext
Loop
Re: Data Control & Bookmarks (DAO) Archived to Disk
Many thanks for the help.
I have now solved the problem. The cause I believe being positioning the current record as the last record during the form load event (this was to obtain a record count). By positioning the current record back to the first record after obtaining the record count as if by magic bookmarks worked !
27-05-2002 at 09:30 PM
|
JLRodgers Level: Moderator Registered: 04-04-2002 Posts: 1617
Re: Data Control & Bookmarks (DAO) Archived to Disk
At least it's working for you now.
Never thought that could have been a problem, but then I've never been able to use .Recordcount in any of my programs. Strange how that happened.