Mark A Matte
markamatte at hotmail.com
Thu May 25 10:56:00 CDT 2006
Max, Below is the condensed version of what the sample showed. Hope it helps. Mark A. Matte IN QUERY as Field where counting Empid or some field ***************************** Countfld: MyAutoCtr([Empid]) ***************************** BEHIND FORM or somewhere to be called EVERYTIME before running query with this function ***************************** lngTableCounter = 1 ***************************** IN A MODULE ***************************** Option Compare Database Option Explicit 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 **************************************** >From: "Max Home" <max at sherman.org.uk> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: "'Access Developers discussion and problem >solving'"<accessd at databaseadvisors.com> >Subject: Re: [AccessD] Record number in query >Date: Thu, 25 May 2006 15:03:04 +0100 > >Mark, can you post this to the list please. Especially if it is only a 2 >line function. I was also waiting for somebody to reply to Chris. > >Regards > >Max > >Ps. Although this has come from my home email address, please reply to my >work Email address (max.sherman at mga-charity.org) as I will still be picking >up my email > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte >Sent: 25 May 2006 14:23 >To: accessd at databaseadvisors.com >Subject: Re: [AccessD] Record number in query > >Chris, > >I sent you a sample db offline that shows what you need. Its a simple 2 >line function...but you have to reset it each time you use it. Also, this >works best with MAKE,APPEND,UPDATE type queries...if you display a query >using this function...the numbers will change as you scroll. > >Let me know if you don't get the offline sample. > >Thanks, > >Mark A. Matte > > > >From: "Chris Foote (Spike)" <spikee at oatlandspark.org.uk> > >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] Record number in query > >Date: Thu, 25 May 2006 08:29:57 +0100 > > > >Good day! > > > >Dumb question here. > > > >I've got a SELECT query and wish to add a calculated field with row >number. > >The number needs to start at 1, for the first record, and increment to n > >for > >record n. I'm sure I've seen a post here recently about this but I cannot > >find it in the archives. > > > >TIA! > >Chris Foote > > > > > >-- > >AccessD mailing list > >AccessD at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/accessd > >Website: http://www.databaseadvisors.com > > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com