B
banem2
Task is simple, but it appear as very though to complete.
Table:
Table1, IDRecord (may be AutoNumber)
record values:
1, 2, 3, 4, 5
This numbers needs to be randomized Rnd(), then extract TOP(n) where
"n" is number on form (Form1!Field1).
To select TOP(n) I am using workaround like this:
SELECT Table1.IDRecord, DCount("IDRecord","Table1","IDRecord <= " &
[IDRecord]) AS TopNum, Table1.*
FROM Table1
WHERE (DCount("IDRecord","Table1","IDRecord <= " &
[IDRecord])<=Val(Forms!Form1!Field1[]));
All works fine until I put RND(RecordID) command and sort by this
number.
If I first randomize records and use second query, it won't create
record number in query in order they appear on screen.
Any solution to randomize records, to create record numbers in query
and filter by TOP(n)?
Goal:
IDRecord, RecNo
1, 1
5, 2
3, 3
4, 4
2, 5
Filter on RecNo by form to have only first "n" records.
Thanks!
Table:
Table1, IDRecord (may be AutoNumber)
record values:
1, 2, 3, 4, 5
This numbers needs to be randomized Rnd(), then extract TOP(n) where
"n" is number on form (Form1!Field1).
To select TOP(n) I am using workaround like this:
SELECT Table1.IDRecord, DCount("IDRecord","Table1","IDRecord <= " &
[IDRecord]) AS TopNum, Table1.*
FROM Table1
WHERE (DCount("IDRecord","Table1","IDRecord <= " &
[IDRecord])<=Val(Forms!Form1!Field1[]));
All works fine until I put RND(RecordID) command and sort by this
number.
If I first randomize records and use second query, it won't create
record number in query in order they appear on screen.
Any solution to randomize records, to create record numbers in query
and filter by TOP(n)?
Goal:
IDRecord, RecNo
1, 1
5, 2
3, 3
4, 4
2, 5
Filter on RecNo by form to have only first "n" records.
Thanks!