DoCmd.GoToRecord .....

Monsora83

Registered User.
Local time
Today, 12:35
Joined
May 16, 2011
Messages
41
I'm using an integer to store specific record number I was my code to jump around to when analyzing data in access. I am changing and storing the value for the record number in 'intCounter'. However access does not seem to like this. Is there a different tecnique I should use to ge this to work?


DoCmd.GoToRecord , , intCounter

Thanks
 
What "Record Number" are you storing? I hope it isn't the one at the bottom of the form which isn in the navigation controls which say Record X of Y. That has nothing to do with the actual record that is in that form. It is just an arbitrary numbering of the current recordset.

Access doesn't store data in the tables in any meaningful order. And when you open a form with a table as the recordset, there is no guarantee that record 5 will be the same record when you open the form again. That numbering is ONLY good for the current session of the form. The minute it is closed or requeried, you can throw that number out the window. Now, it may SEEM like the numbers are the same as many times the data does come into the form in the same order, but unless you apply an Order By in a query and use that as the underlying recordsource of the form, the records will not be in any particular order. And if records are added or deleted it is possible to have them mix up even more.
 
What "Record Number" are you storing? I hope it isn't the one at the bottom of the form which isn in the navigation controls which say Record X of Y. That has nothing to do with the actual record that is in that form. It is just an arbitrary numbering of the current recordset.

Access doesn't store data in the tables in any meaningful order. And when you open a form with a table as the recordset, there is no guarantee that record 5 will be the same record when you open the form again. That numbering is ONLY good for the current session of the form. The minute it is closed or requeried, you can throw that number out the window. Now, it may SEEM like the numbers are the same as many times the data does come into the form in the same order, but unless you apply an Order By in a query and use that as the underlying recordsource of the form, the records will not be in any particular order. And if records are added or deleted it is possible to have them mix up even more.


I should have been more specific. But what you mentioned above is exactly how I want it to act and have it designed as such to allow it.

I do understand that the record ID for the filtered query I make will always be changing. This works well to my advanage in this case, all the data will be filtered by a form for the users, and already set up in the proper ordering with the 'Order By' in the queries.

For calculations done on specific filtered records I will need it to jump around to selected records that will be highlighted as the 'normalizing' data point which all other data in the filtered query will reference.
 
How about just going to the record's ID:
Code:
Dim rst As DAO.Recordset
 
Set rst = Me.RecordsetClone
 
rst.FindFirst "[IDFieldNameHere]=" & lngStoredID
 
If rst.NoMatch Then
  ' do something here if there is no match or just ignore it
Else
   Me.Bookmark = rst.Bookmark
End If
 
rst.Close
Set rst = Nothing
 

Users who are viewing this thread

Back
Top Bottom