Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve Internal Row ID

Status
Not open for further replies.

bebop

Programmer
Oct 15, 2002
5
US
Does anyone know how to retrieve the internal row id of a record using sql?
 
I was wondering what you are trying to do, let me know and perhaps I can help.
 
I am using a gotorecord action on a form in Access and one of the attributes is the record id of the record I want to go to.

Example: DoCmd.GoToRecord acDataForm, "Employees", acGoTo, 7

The 7 in the above example is the record I want to go to but I need to be able to retrieve that value from my recordset.
 
When my users open/close a form I think its nice to place the user on the same record again when he/she opens this form again.
I use this code:

Dim rs As Object
Rec= DLookup("Rec", "Last", "Form='YrForm'")
If Not IsBlank(Rec) Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[Regnr] = " & Rec
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End If

In order to get the whole thing to work I have a tbl called Last withe fields Rec,Form,User (I do not user the user field in this example).

The IsBlank function is a little function that I use as I got tired of having to check isnull and isempty etc. etc.

I incl. the function here:

Function IsBlank(V As Variant) As Boolean
On Error Resume Next
V = "" & V
If Len(V) = 0 Then IsBlank = True
End Function

I know that this is not exactly what you wanted but its "up the alley".

Herman
 
It looks like you want to position to a record in a forms underlying recordset.

If this is what you are trying to do, clone the forms recorset. Use the find first method to find the record you want, Set the forms bookmark to the cloned records bookmark, close the cloned recordset, and you’ve done it.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top