Form Record ID

  • Thread starter Thread starter Wayne Emminizer
  • Start date Start date
W

Wayne Emminizer

I need to be able to identify each record on a form to be
able to pass it to code I have to create a name. The
navigation bar at the bottom of the tells me that I am on
record X of XX. How can I "grab" that ID? I have the
code working on a temp table using an autonumber field
using the For Next loop to advance to the next record.
The other solution I suppose would be to add a number to
each record (1,2,3,etc) much like an autonumber but on
the form or in the query. Any advice how to do either?
 
Hi Wayne

You cannot use the record number on a form to uniquely identify the record.
Record numbers change as you (a) apply or remove filters, (b) change sort
orders, and (c) add/remove records.

Each of your records should have a unique "primary key". If there is no
field that already contains a unique value, like customer number, then add
an AutoNumber field.
 
Thanks for the response...that's the whole point of the
need. I have two fields set as the primary
key....problem is that in order to loop from one item to
the next I need to be able to ID that record so I can use
the key values to lookup spec fields and build a
description on the fly...how can I manually add an
incremental numbering field to my query to get that
unique numbers? Any ideas?
-----Original Message-----
Hi Wayne

You cannot use the record number on a form to uniquely identify the record.
Record numbers change as you (a) apply or remove filters, (b) change sort
orders, and (c) add/remove records.

Each of your records should have a unique "primary key". If there is no
field that already contains a unique value, like customer number, then add
an AutoNumber field.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


I need to be able to identify each record on a form to be
able to pass it to code I have to create a name. The
navigation bar at the bottom of the tells me that I am on
record X of XX. How can I "grab" that ID? I have the
code working on a temp table using an autonumber field
using the For Next loop to advance to the next record.
The other solution I suppose would be to add a number to
each record (1,2,3,etc) much like an autonumber but on
the form or in the query. Any advice how to do either?


.
 
I think you can just create another field, and set it to 'autonumber' type.
even if that is all you use that field for.

However, experts correct me if I am wrong, but are not primary keys supposed
to be 'primary'? As in, having more than one is a Bad Thing?

Wayne Emminizer said:
Thanks for the response...that's the whole point of the
need. I have two fields set as the primary
key....problem is that in order to loop from one item to
the next I need to be able to ID that record so I can use
the key values to lookup spec fields and build a
description on the fly...how can I manually add an
incremental numbering field to my query to get that
unique numbers? Any ideas?
-----Original Message-----
Hi Wayne

You cannot use the record number on a form to uniquely identify the record.
Record numbers change as you (a) apply or remove filters, (b) change sort
orders, and (c) add/remove records.

Each of your records should have a unique "primary key". If there is no
field that already contains a unique value, like customer number, then add
an AutoNumber field.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


I need to be able to identify each record on a form to be
able to pass it to code I have to create a name. The
navigation bar at the bottom of the tells me that I am on
record X of XX. How can I "grab" that ID? I have the
code working on a temp table using an autonumber field
using the For Next loop to advance to the next record.
The other solution I suppose would be to add a number to
each record (1,2,3,etc) much like an autonumber but on
the form or in the query. Any advice how to do either?


.
 
That's pretty much the same conclusion I came to and
that's what I did..created another field using Autonumber
for that purpose.
-----Original Message-----
I think you can just create another field, and set it to 'autonumber' type.
even if that is all you use that field for.

However, experts correct me if I am wrong, but are not primary keys supposed
to be 'primary'? As in, having more than one is a Bad Thing?

Thanks for the response...that's the whole point of the
need. I have two fields set as the primary
key....problem is that in order to loop from one item to
the next I need to be able to ID that record so I can use
the key values to lookup spec fields and build a
description on the fly...how can I manually add an
incremental numbering field to my query to get that
unique numbers? Any ideas?
-----Original Message-----
Hi Wayne

You cannot use the record number on a form to uniquely identify the record.
Record numbers change as you (a) apply or remove filters, (b) change sort
orders, and (c) add/remove records.

Each of your records should have a unique "primary key". If there is no
field that already contains a unique value, like customer number, then add
an AutoNumber field.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


"Wayne Emminizer"
wrote in message to
be am
on number
to


.
 
Back
Top