goto a specific record

G

Guest

can i move the user to a specific record based on recordnumber. i mean goto
record number 5.
 
R

Rick B

Record number should not be used. You should have your own key field that
you use to reference records.
 
P

Powderfinger

You can use

rst.Move 5


To move 5 records past from where you are. GoTo the first record first, if
you want to move to an exact record position. i.e.

rst.MoveFirst
rst.Move 5

This is ADO so you need to declare something like this first:

Dim rst As ADODB.Recordset
rst.Open strTableName, CurrentDb(), adOpenStatic, adLockOptimistic
 
N

Nick 'The database Guy'

Hi Max,

Yes you can do this, however there should be some other criteria that
you search on. It would probably be quite simple if you had just 5,
10, or even 25 records if they were being used all the time people
would get to remember them. However this learning curve is not really
necessary and should be avoided if you want people to accept your
software. Search on name, or size or colour or what is made out of or
anything more descriptive than a number.

Also when (if) your db gets used imagine if it had 2000 records or
20000 you can't ask people to remember a number that big!

Good luck

Nick
 
G

Guest

Record numbers are Like Santa Claus. We all love them, but they don't exist
in Access. The record number you see is only a relatvie number based on the
current ordering and filtering of a recordset.

The best way to allow the user to select a specific record is by using a
combo box and a little code based on the primary key or another field were
the value of the field will be unique. For performance purposes, this field
should be indexed.

Create a combo box with a query based on the recordset and field you want to
use:

SELECT SSN From tblMembers;

Then in the After Update event of the combo:

Dim rst As Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "SSN = '" & Me.cboSSN
If rst.NoMatch Then
MsgBox "No Match Found for " & Me.cboSSN, vbCritial, "Data Error"
Else
Me.Bookmark = rst.Bookmark
End If

Set rst = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top