By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,234 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,234 IT Pros & Developers. It's quick & easy.

Including a Blank Field in a Key

P: n/a
Hi, I have a table where two fields will make up the primary key. In
a few cases the second field will be blank. When I try to append the
existing data into the keyed table I get the message that it cannot
append a null value into the keyed field.

Is there any way to set this up to allow the nulls in that second
field?

Thanks for any assistnace with this.

Robbie Bollinger
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Nulls not allowed in key fields...no way around that. Change the PK for you
table to fields that reflect the true nature of the data and that will not
be null.
Nov 12 '05 #2

P: n/a
ro*****@hotmail.com (R Bolling) wrote in message news:<6e**************************@posting.google. com>...
Hi, I have a table where two fields will make up the primary key. In
a few cases the second field will be blank. When I try to append the
existing data into the keyed table I get the message that it cannot
append a null value into the keyed field.

Is there any way to set this up to allow the nulls in that second
field?

Thanks for any assistnace with this.

Robbie Bollinger


Robbie: Ran into this myself recently, and had solved it this way:
Don't use a multi-field key.

Make a numeric field as you PK. Programmatically increase the ID
number (of course don't use AutoNumber). Then, open the Indexes
display (right next to the PK toolbar button) and manually create a
new index.

In the Index Name field, enter "SecondaryKey" (or whatever you want).
Enter your first field name on that same row. Enter the second in the
next row. Move back up to the row above, and then, in the bottom half
of the pop-up, change "Unique" to Yes, and "Ignore Nulls" to Yes.

You can't ignore nulls on the primary key, but any others are
perfectly acceptable. Hopefully this works for your project.

Anthony.
Nov 12 '05 #3

P: n/a
"Anthony Cuttitta Jr." <ac*******@railvan.com> wrote in message
news:66**************************@posting.google.c om...
ro*****@hotmail.com (R Bolling) wrote in message news:<6e**************************@posting.google. com>...
Hi, I have a table where two fields will make up the primary key. In
a few cases the second field will be blank. When I try to append the
existing data into the keyed table I get the message that it cannot
append a null value into the keyed field.

Is there any way to set this up to allow the nulls in that second
field?

Thanks for any assistnace with this.

Robbie Bollinger


Robbie: Ran into this myself recently, and had solved it this way:
Don't use a multi-field key.

Make a numeric field as you PK. Programmatically increase the ID
number (of course don't use AutoNumber).


why 'of course'? Then, open the Indexes
display (right next to the PK toolbar button) and manually create a
new index.

In the Index Name field, enter "SecondaryKey" (or whatever you want).
Enter your first field name on that same row. Enter the second in the
next row. Move back up to the row above, and then, in the bottom half
of the pop-up, change "Unique" to Yes, and "Ignore Nulls" to Yes.

You can't ignore nulls on the primary key, but any others are
perfectly acceptable. Hopefully this works for your project.


Yes, assuming that's what he wants. Robbie actually hasn't told us enough
really.
Nov 12 '05 #4

P: n/a
"rkc" <rk*@yabba.dabba.do.rochester.rr.com> wrote in message
news:EF*******************@twister.nyroc.rr.com...

"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f*********************@pubnews.gradwell.net. ..
"Anthony Cuttitta Jr." <ac*******@railvan.com> wrote in message
news:66**************************@posting.google.c om...

You can't ignore nulls on the primary key, but any others are
perfectly acceptable. Hopefully this works for your project.


Yes, assuming that's what he wants. Robbie actually hasn't told us enough really.


You mean like why a two column primary key is necessary, yet not
necessary, at the same time?


Yes, something like that.
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.