Results 1 to 3 of 3
  1. #1
    Stulgs is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    1

    Question New to Acess Help: Index or primary key cannot contain a null value.

    Hello!
    I'm a new Access user and I've run into this problem with my simple two operation database.

    I'm trying to record a payment, but I keep getting this error upon completion of my form:

    Index or primary key cannot contain a null value.

    I've checked the data types and relationships and they seem to be fine.

    I've searched the forum for similar discussions, but the databases used in the solutions were much more complicated than what I'm dealing with.

    Here are links to my Access files (2007 & 2003)for your reference (& help!):
    http://dl.dropbox.com/u/25775187/Stu...ring2012.accdb


    http://dl.dropbox.com/u/25775187/Stu...g2012%20ov.mdb

    Thanks for your help!

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Do not know if this is the cause, but till someone comes along, just check out :
    Your table tblClients-Payments has Client ID as part of primary key.
    Does your sub-form sfrmPayments pass the Client ID ?

    Thanks

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Have made a couple of changes to your db.

    Added Client ID to the query that is the Record Source for sfrmPayments.
    Entered one line of code in the form's Before Update event.
    Me.[Client ID] = Parent.sfrmClient.Form.[Client ID]

    This seems to give the desired result. Others may be able to offer something better.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 4
    Last Post: 04-19-2012, 11:01 AM
  2. Replies: 3
    Last Post: 10-11-2011, 01:43 PM
  3. Replies: 37
    Last Post: 08-10-2011, 09:43 AM
  4. Replies: 9
    Last Post: 07-14-2011, 07:20 AM
  5. index/primary cannot contain null value
    By BinHDreW in forum Access
    Replies: 1
    Last Post: 05-26-2011, 08:25 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