Results 1 to 3 of 3
  1. #1
    kymmyg is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    1

    Red face Using composite keys to enter data in a form

    Hi all
    I have a table with a composite key and these keys are put onto a form. The first key is the Mnemonic field which is a text box to enter a value into, and the second key is the Driver field which is a dropdown box linked to the Driver table containing the names of all the Drivers (both fields are intially blank on the form).

    Each Driver can have multiple Mnemonics.



    When I enter a Mnemonic and then tab to the Driver field, I get the message "Index or primary key cannot contain a Null value.".

    In the table, I have set both Driver's and Mnemonic's properties to - Required = No, Indexed = Yes (Duplicates OK).

    How do I get around the problem of entering both keys without getting the error? What is stopping this happening?

  2. #2
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    This error can be caused by several factors.

    The first thing I'd do is try and manually enter the information into the Tables directly. If you still receive an error then the cause is most likely a bad Relationship between the two Tables.

    If you can enter the data directly, the problem is likely with the Form itself.

  3. #3
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    perhaps just word definition problem with something called a "key" which can be null or duplicate vs a 'primary key' where null/duplicate is a contradiction in terms (at least my terms....).

    I suggest that you add a column to your table that is set up to be an autonumber and as the primary key (with the key symbol at it)...and remove the key from the other fields if they are there. Your existing fields can continue their roles as cross referencing 'key' fields to other tables.

    A table's primary key must always exist and always have a unique value (with some exceptions such as static lists do not need a primary key).

    hope this helps.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-03-2010, 01:33 PM
  2. Replies: 1
    Last Post: 07-27-2010, 08:02 AM
  3. How do I enter data automatically?
    By ffurqana in forum Access
    Replies: 0
    Last Post: 07-08-2010, 07:47 PM
  4. Adding a table cannot enter data
    By tak4 in forum Queries
    Replies: 0
    Last Post: 02-03-2009, 10:04 AM
  5. can't enter data in some form fields
    By ashiers in forum Forms
    Replies: 1
    Last Post: 09-18-2008, 12:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums