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".
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.