Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box error using autonumber as primary key

Status
Not open for further replies.

Sullaway

Technical User
Sep 27, 2000
50
US
I have converted CustomerID (autonumber-primary key) to a combo box to look up customers. In the combo box CustomerID is the bound field. This works good except for one problem. If the user deletes the contents of the combo box and tabs out of the field they get an Access error stating can not contain null value, etc. I have tried trapping this error but have not had any luck. Can someone please help me with trapping this error. (or maybe advise of a better way to accomplish what I'm trying to do?)

Thanks ahead of time for any help you can give me.

Shane
 
Hi,
Check the primary key field in the table to see if they have the "Required" property set to "Yes", or the "Allow zero length" property set to "No" (if text field). A primary key field has an "Indexed" property set to "Yes (No Duplicates)" this means that if any other record in that table already has a blank or Null value, then you have 1. If you try to blank out/clear another record, you will have 2 - thus duplicate fields with blank or Null values. If I am correct in this analysis - I would advise that you change your design so that the primary key has nothing to do with the combo box. Combo boxes are usually used to assign an attribute to a particular record. Thus many records can have the same attribute - this violates the primary key indexing.

Rob Marriott
rob@career-connections.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top