469,304 Members | 2,192 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

get the record number from the access db

hai,
I want to get the record number in access using select statement. please help. Thanks in advance.
indra.G
Dec 9 '06 #1
5 9764
MMcCarthy
14,534 Expert Mod 8TB
hai,
I want to get the record number in access using select statement. please help. Thanks in advance.
indra.G
indra

You cannot get a record number in access. You can only identify it by it's primary key or other unique value.

Mary
Dec 9 '06 #2
ADezii
8,800 Expert 8TB
hai,
I want to get the record number in access using select statement. please help. Thanks in advance.
indra.G
'As far as I know, you cannot retrieve it via a SELECT Statement but this is
'how I retrieve it via VBA coding:

Expand|Select|Wrap|Line Numbers
  1. Dim recClone As DAO.Recordset
  2.  
  3. Set recClone = Me.RecordsetClone()             'Copy of the Form's underlying Recordset
  4. recClone.Bookmark = Me.Bookmark             'Resync Bookmarks
  5. Debug.Print recClone.AbsolutePosition + 1    'Returns the Record Number
Dec 10 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Nice piece of code ADezii.

I assume it only works if the form is based on the table with no criteria or sort order.

Mary

'As far as I know, you cannot retrieve it via a SELECT Statement but this is
'how I retrieve it via VBA coding:

Expand|Select|Wrap|Line Numbers
  1. Dim recClone As DAO.Recordset
  2.  
  3. Set recClone = Me.RecordsetClone()             'Copy of the Form's underlying Recordset
  4. recClone.Bookmark = Me.Bookmark             'Resync Bookmarks
  5. Debug.Print recClone.AbsolutePosition + 1    'Returns the Record Number
Dec 10 '06 #4
Nice piece of code ADezii.

I assume it only works if the form is based on the table with no criteria or sort order.

Mary
Sir,
I have created a database in access and iam using vb as front end. For the data report the data source is dataenvironment.For e.g I have nearly 100 records and i am selecting few records based on a condition in the dataenvironment sql command(select * from contract where vtcno>?) and placing the dataenvironment as the data source to the data reort. The selected records should be numbered(1,2,3...) in the data report by adding an additional field in the data report.
thnaks
indra
Dec 11 '06 #5
MMcCarthy
14,534 Expert Mod 8TB
If you are creating your frontend in VB you might want to post this in the Visual Basic forum as well. Some of their experts do hang out here but you are more likely to get an answer to your question over there.

Mary
Dec 11 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by DS | last post: by
27 posts views Thread by Kim Webb | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.