query for Inserting random records into temporary table (1 Viewer)

BennyLinton

Registered User.
Local time
Yesterday, 19:00
Joined
Feb 21, 2014
Messages
263
I'm trying to insert 10% of a dataset from dbo_billing into another table Random_Temp. Another form is open when this query is to be ran that passess in the billyear and billmonth... I'm sure it's a syntax issue as I can isolate the random number part and it displays the appropriate data, I just can't re-write it to insert into the other table:


INSERT INTO Random_Temp ( indx, peopleId, audited )
SELECT TOP 10 PERCENT b.indx, b.peopleId, b.audited
FROM dbo_Billing AS b
WHERE (((b.billYear)=[Forms]![billing]![billyear]) AND ((b.billMonth)=[Forms]![billing]![billmonth]) AND ((b.recertifying)=-1))
ORDER BY Rnd(-(1000*b.indx)*Time());
 

MarkK

bit cruncher
Local time
Yesterday, 19:00
Joined
Mar 17, 2004
Messages
8,181
What fails about what you posted? What makes you think it's a syntax issue? Remember we know nothing, zero, zilch, na-da, about what is failing here.
 

burrina

Registered User.
Local time
Yesterday, 21:00
Joined
May 10, 2014
Messages
972
I'm not sure I understand it? Are you trying to use the open query to add data to another table or are you using a sql statement? Or are you using command button to run this?
 

Users who are viewing this thread

Top Bottom