[AccessD] Select every nth record

Mark A Matte markamatte at hotmail.com
Fri May 18 10:35:47 CDT 2007


John,

I do something similar to get duplex printing of postcards.  There is a 
sample db on the DBA website under the 2002 conference page.

Basically I create an autonumber in a query using the function MyAutoCtr() 
...(module below)...Then I filter out the even number records using the MOD 
function.

Hope that helps...let me know if you have any questions.

Thanks,

Mark A. Matte


************Module***************
Global lngTableCounter As Long

Function MyAutoCtr(prmAny)
'Trick is to pass a field from the input table(s) so that function called 
for each record
'otherwise Access thinks that the function will always return the same value 
and
'only calls it once, and every output record gets the same value
MyAutoCtr = lngTableCounter
lngTableCounter = lngTableCounter + 1
End Function
************Module***************


>From: "jwcolby" <jwcolby at colbyconsulting.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "'Access Developers discussion and problem 
>solving'"<accessd at databaseadvisors.com>
>Subject: [AccessD] Select every nth record
>Date: Fri, 18 May 2007 11:06:18 -0400
>
>Is there a SQL statement that will do this directly?  I have a table of 40K
>records and I want to split it into two tables, each containing every other
>record of the 40K record table.
>
>John W. Colby
>Colby Consulting
>www.ColbyConsulting.com
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
Catch suspicious messages before you open them—with Windows Live Hotmail. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_protection_0507




More information about the AccessD mailing list