naming a primary key when there are > fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

i would like to reference my PK in an expression like

Me.txtCurKey = Me.nameofPKfield

where the nameofPKfield refers to a PK consisting of five fields in the
form's underlying table: LastName,FirstName,MI,MR_Number,IRB_Number

looking at the listing of the PK in the table's properties shows me a
default name of "PrimaryKey" in the column labeled Index Name, but that
doesnot in VBA code.

so, what is the name of the PK?
 
You've got an index on those 5 fields, and the index will be named
PrimaryKey, but it's not as though there's a single field that contains the
concatenated value of those 5 fields.
 
Consider adding a single field autonumber PK, replacing your (5) field concatenated key with a multi-field unique index. Then, referencing the PK in an expression is very simple.

See http://www.access.qbuilt.com/html/articles.html ---> The Case for the Surrogate Key

and
http://www.utteraccess.com/forums/s...=247916&page=0&view=collapsed&sb=5&o=&fpart=1


Tom
_____________________________________


hi,

i would like to reference my PK in an expression like

Me.txtCurKey = Me.nameofPKfield

where the nameofPKfield refers to a PK consisting of five fields in the
form's underlying table: LastName,FirstName,MI,MR_Number,IRB_Number

looking at the listing of the PK in the table's properties shows me a
default name of "PrimaryKey" in the column labeled Index Name, but that
doesnot in VBA code.

so, what is the name of the PK?
 
Back
Top