Displaying 5 random records from a database table

T

technoplonker

I have an access 2000 database and I would like to create a script
that will allow me to display 5 Random unique results.

I have tried to use the tutorial at
http://www.4guysfromrolla.com/webtech/102999-1.shtml

The problem is that the line objRst.LockType = adLockOptimistic throws
out the following error:

'Arguments are of the wrong type, are out of acceptable range, or are
in conflict with one another.'

When I set it to 3 instead of the adLockOptimistic I then get an error
with the line objRst.MoveLast:

'Rowset does not support fetching backward.'

Can anyone help?
 
M

Manohar Kamath [MVP]

Looks like the problem could be because you are missing the adovbs.inc file.
Or at least, you use following values instead of the constants:

adLockOptimistic = 3
adOpenKeySet = 1

Perhaps you are opening the recordset with adLockOptimistic lock type, but
the cursor is being opened as adOpenForwardOnly (the default, 0) mode.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top