Re: Finding a record number using SQL
- From: "JTH" <jhoward@xxxxxxxxxxxx>
- Date: Mon, 10 Dec 2007 11:59:58 -0700
I am all ready using a "auto number" field as the primary key but I want to
use a query to visually display the data into a grid and use an order by to
sequentially sort the data for the user. It might not be the most logical
way of doing this but it works best for my situation.
I am only looking at trying to find the row number after an insert and
refresh so that I can point to the newly inserted record by setting the
recno property within the query.
I know that I can user a query to logically order the records within the
query but am not sure of the right syntax? Just wonder if it is possible and
if so how would the sql statement look like.
Jeff
"Del Murray" <Del.Murray@xxxxxxxxxxxxxx> wrote in message
news:4759cf06$1@xxxxxxxxxxxxxxxxxxxxxxxxx
In any DB you need a primary unique key. In Accesss you can use a
"counter" type large integer and the system will increment it for you.
Include the column defined as counter in your recordset. Then when you
insert a record and post it, the db will populate the field for you. You
then do a "locate" on the key. Something like this ...
disablecontrols
insert
fieldbyname('xxx').asstring = 'sometheing'
fieldbynaem('yyy').asfloat := 12345
post
savekey := fieldbyname('counterfield').asfloat
locate('counter', savekey,[])
enablecontrols
.
- Follow-Ups:
- Re: Finding a record number using SQL
- From: Del Murray
- Re: Finding a record number using SQL
- References:
- Finding a record number using SQL
- From: JTH
- Re: Finding a record number using SQL
- From: Del Murray
- Re: Finding a record number using SQL
- From: JTH
- Re: Finding a record number using SQL
- From: Bill Todd
- Re: Finding a record number using SQL
- From: JTH
- Re: Finding a record number using SQL
- From: Del Murray
- Finding a record number using SQL
- Prev by Date: Re: Milliseconds to SQL Server DateTime
- Next by Date: Re: Finding a record number using SQL
- Previous by thread: Re: Finding a record number using SQL
- Next by thread: Re: Finding a record number using SQL
- Index(es):
Relevant Pages
|