Connecting Tech Pros Worldwide Forums | Help | Site Map

Record number or row number

Guest
 
Posts: n/a
#1: Mar 19 '06
How can I obtain the record number or row number for a record while in form
view?

Thank you in advance for any information.

R. L.



MGFoster
Guest
 
Posts: n/a
#2: Mar 19 '06

re: Record number or row number


billiards9@sbcglobal.net wrote:[color=blue]
> How can I obtain the record number or row number for a record while in form
> view?[/color]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There are not "natural" row (aka record) numbers in a relational db's
table, since, by definition, a table is an unordered set.

In a Recordset you can use the AbsolutePosition or a BookMark. These
are not row numbers as such, they are only pointers into the retrieved
recordset. IOW, they don't mean anything per the data, only the
position of the row in the, ordered or unordered, recordset.

In VBA:

A bookmark:

' in the form's Declaration section
dim strBookmark as string

' when you want to mark a place in the form's recordset
' that you want to return to:
strBookmark = Me.Bookmark

' when you want to return to that remembered record:
Me.Bookmark = strBookmark

To find out the AbsolutePosition - example, a command button:

Private Sub cmdWhatPosition_Click()
MsgBox "The Absolute Position: " & Me.Recordset.AbsolutePosition
End Sub

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRB2KNYechKqOuFEgEQIv5wCdE1eXHujdjcUFSW+Dza18hg XQ/yQAoMC2
/ysQf1h+yGmRhLqDRqfjdlrE
=2gy7
-----END PGP SIGNATURE-----
Closed Thread