[AccessD] Autonumber in queries

Andy Lacey andy at minstersystems.co.uk
Wed Jul 7 01:38:08 CDT 2004


Hi Dale

Create a module with this in:

Global lngTableCounter As Long

Function MyAutoCtr(prmAny)
MyAutoCtr = lngTableCounter
lngTableCounter = lngTableCounter + 1
End Function

Before running the query set lngTableCounter =0

In Query make a column such as

MyAutoCtr([anyfieldname]) As Counter


You must pass a field from the input table(s) as in this example 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.

-- Andy Lacey
http://www.minstersystems.co.uk 



> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dale Kalsow
> Sent: 06 July 2004 22:02
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Autonumber in queries
> 
> 
> 
> Does any one know how to add a column in a query that is an 
> autonumber column?
> 
>  
> 
> Thanks!
> 
>  
> 
> Dale
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/a> ccessd
> Website: 
> http://www.databaseadvisors.com
> 
> 




More information about the AccessD mailing list