Hi,
I think problem is this is kind common but I can't seem to find an easy solutions.
I have a TEXT file linked as a table (SOURCE) to my DB.
I have a Query (SOURCE_WLU) that uses the TEXT file plus is linked to several others tables in the DB.
i am trying to get a 5 random values out SOURCE_WLU.
so here is my code:
this gives me the top 5, but most of the time they are the same so I modified the code to :
when i use my second code the rs.movelast TAKES FOR EVER! more than 30m. This is due to the linked tables on the SOURCE_WLU.
if i run any of these codes on SOURCE the code is executed in seconds. But the problem is that i need the linked tables.
I cannot convert to a Table at this moment since it will generate a larger than 2GB file, so I need the user to select some fields and limit the records before doing so.
I know before hand how many records there are on SOURCE_WLU, so i don't need to run rs.movelast, but rs.percentpostion and rs.absoluteposition NEED rs.movelast to get populated or generated.
my problem is with rs.movelast. if there was a way for me to use rs.percentposition without calling this method will be great.
if anyone has an idea on how i can do this with uptimum performance I will appreciate it!
Thanks!
Kimo.
I think problem is this is kind common but I can't seem to find an easy solutions.
I have a TEXT file linked as a table (SOURCE) to my DB.
I have a Query (SOURCE_WLU) that uses the TEXT file plus is linked to several others tables in the DB.
i am trying to get a 5 random values out SOURCE_WLU.
so here is my code:
Code:
'Note: ALL FIELDS are TEXT
set rs = currentdb.openrecordset("SELECT TOP 5 FIELD1 FROM SOURCE_WLU")
msg = ""
do until rs.eof
msg = msg & rs.fields(0).value
rs.movenext
loop
this gives me the top 5, but most of the time they are the same so I modified the code to :
Code:
set rs = currentdb.openrecordset("SELECT FIELD1 FROM SOURCE_WLU")
msg = ""
if not rs.eof then
rs.movelast
rs.PercentPosition = 20
msg = msg & rs.fields(0).value
rs.PercentPosition = 40
msg = msg & rs.fields(0).value
'... and so on
'also could be used with AbsolutePosition if you know your RecordCount
end if
when i use my second code the rs.movelast TAKES FOR EVER! more than 30m. This is due to the linked tables on the SOURCE_WLU.
if i run any of these codes on SOURCE the code is executed in seconds. But the problem is that i need the linked tables.
I cannot convert to a Table at this moment since it will generate a larger than 2GB file, so I need the user to select some fields and limit the records before doing so.
I know before hand how many records there are on SOURCE_WLU, so i don't need to run rs.movelast, but rs.percentpostion and rs.absoluteposition NEED rs.movelast to get populated or generated.
my problem is with rs.movelast. if there was a way for me to use rs.percentposition without calling this method will be great.
if anyone has an idea on how i can do this with uptimum performance I will appreciate it!
Thanks!
Kimo.