473,671 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Including a Blank Field in a Key

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
4 1912
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
ro*****@hotmail .com (R Bolling) wrote in message news:<6e******* *************** ****@posting.go ogle.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. Programmaticall y 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 "SecondaryK ey" (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
"Anthony Cuttitta Jr." <ac*******@rail van.com> wrote in message
news:66******** *************** ***@posting.goo gle.com...
ro*****@hotmail .com (R Bolling) wrote in message news:<6e******* *************** ****@posting.go ogle.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. Programmaticall y 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 "SecondaryK ey" (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
"rkc" <rk*@yabba.dabb a.do.rochester. rr.com> wrote in message
news:EF******** ***********@twi ster.nyroc.rr.c om...

"Mike MacSween" <mi************ ******@btintern et.com> wrote in message
news:3f******** *************@p ubnews.gradwell .net...
"Anthony Cuttitta Jr." <ac*******@rail van.com> wrote in message
news:66******** *************** ***@posting.goo gle.com...

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3229
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically generated, though. I'd like to capture the NAME of every HTML form field element on the server, even if that element is submitted blank. The trouble is, with, say, radio buttons or checkboxes for example, a *blank* element does not get submitted at all.
1
4283
by: Joel | last post by:
Hi, How do you determine if a Date field is blank. In my Sql statement I only want records who's date field is blank (i.e. checking for only open invoices where Date_Paid = '' ...still open ...it doesn't work when I use that syntax) Thank you
19
6994
by: Joe Scully | last post by:
Hi all, I am having trouble with access adding a blank record to a subform everytime I finish entering data and closing the form. (The form and subform are based on the one table) When entering data into the subform I get the pencil icon to show data addition, but underneath the record I am inputting data the record is blank with a star(*)icon and this is the record(blank)that always gets saved with all the records that actually have...
2
2248
by: JC Mugs | last post by:
I have a form that when you tab from field to field that the entry point is blank, but if you point and click in the field it brings up a 0 and data entry is started to the left of the zero. Thus if you are click and enter 8 becomes 80, but if you tab to the field and enter 8 it is 8. So my question: is there an easy way to have Access XP-2002 keep the entry on the form blank when you click on a field to enter data?
5
2444
by: ChadDiesel | last post by:
My basic question is why does my print report button on my subform print a blank report when my cursor is on a blank entry line? Here is a more detailed explanation of my problem. I have a form that contains shipment destination information and a subform that contains boxes for that shipment. The main form is a table called Ship_Info, and the subform is a table called Label_Info. They both contain and are linked by a field called...
2
3153
by: JohnR | last post by:
When creating an msAccess db within the Access UI itself the fields that are text are NOT padded with blanks. For example, if I have a 10 char field and put in "HI" and then when I come back to the field and click my mouse on it the cursor is just after the "I" in "HI"... that is, no blanks were added to the field. However, when I create an MDB database programatically in VB.Net using ADOX and create the tables using SQL stmts (ie:...
0
2151
by: visionstate | last post by:
Hi there, I have a form which has 2 text boxes, a combo box and a sub form in it (which reads from a query. The query reads from the table). On load, I would like the fields in the text boxes and combo box to be become blank. If I use the "" or 'null' instruction then this in turn makes the corresponding field in the sub form blank which in turn makes the query field blank and the table field blank! If I then change the combo box option,...
1
2139
by: BethanyBez | last post by:
Is there any way when doing a merge with an Access Query and a columned Word doc that I can avoid blank spaces where the field is blank? I am creating a columned contact sheet with the contacts grouped by state and then position title. Some of the states do not have certain positions filled and this creates a big blank rather than jumping on to the next position. I heard that if I saved my query as a table after filtering out Null values...
4
2209
by: sparks | last post by:
I am trying to fix a database that someone did about 4 yrs ago in access97. The main table just contains demographics and is on the main form of the database. It has a subform on a tab that contains the other information. it is set 1 to 1 in the relationships. simplify if I can
0
8392
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8912
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8669
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.