Trouble with Primary key

dogman01

Registered User.
Local time
Today, 11:32
Joined
Dec 3, 2008
Messages
47
I have a table with only 5 fields right now but I am having issues getting a Primary key to do what I want. I have an expression for this field that simply displays the contents of 3 other fields together. The trouble is that I cannot get the field to hold it's data. When I input data into the other 3 fields it show it combined in the field I want as the Primary yet when I tab to create a new record it tells me that it can't save the data because that required field is blank. Any solution? Thanks in advance- dogman01:confused:
 
see if any of your fields in the table are set as required=true

this has nothing ot do with keys - if data is required, and you leave it blank, access cant save the record

either enter data, or set required=no

note that if you set required=no, with text fields, you may also need to set allow zls to yes
 
All of the fields are set to "Required"=No. So I went in to the form and added data to the 3 field which then showed up combined in the field I have set as Primary but then when all the fields had data and I went to create new record it still tells me that I cannot add the last record because the field I have as Primary is a null value. It's not recognizing the combined data for the one field as having any data.
 
use a compound key instead of assigning concatenated values to the PK.
 
Thats sounds like it could be the solution but not sure the process to create a compund key. I am investigation now but so far Access 2003 help isn't cooperating.
 
Figured it out and it works by using 4 fields as Primary key. Thanks
 
Much easier to stick an autonumber as a PK hidden from the user and concatenate your data to produce a user visible ID.
 
I'm surprised nobody else commented on this.

I have an expression for this field that simply displays the contents of 3 other fields together.

You cannot have an expression in a table. Expressions can only exist in queries, form/report controls, or VBA code.
 

Users who are viewing this thread

Back
Top Bottom