Error - "The field cannot contain a null value because the Require

M

Mike

Hi,

I'm getting one error left in my contact management database. I get the
following error: "The field 'Calls.ContactID' cannot contain a Null value
because the Required property for this field is set to True. Enter a value
in this field."

I can't find what I need to do to fix this. The error occurs in a memo
field in the Call Details subform. If I type directly into the subform, no
errors. If I go out of the Contacts form (which contains the subform) and
back in, it seems to work. How can I track down what is causing this error?

Thanks,

Mike
 
A

Anand.V.V.N

hello,
I am not sure if this would help, but can you check your table design and
the relations between the tables and the fields, may be they'll help you tack
the error.
 
J

John W. Vinson

Hi,

I'm getting one error left in my contact management database. I get the
following error: "The field 'Calls.ContactID' cannot contain a Null value
because the Required property for this field is set to True. Enter a value
in this field."

I can't find what I need to do to fix this. The error occurs in a memo
field in the Call Details subform. If I type directly into the subform, no
errors. If I go out of the Contacts form (which contains the subform) and
back in, it seems to work. How can I track down what is causing this error?

What are the Recordsources of the mainform and the subform? What's the
Master/Child Link Field? If it's ContactID, has the mainform's contactID field
been generated at the time you try to insert data?
 
M

Mike

John,

Thanks for the reply. Comments inline. My apologies, but this is my first
database and I'm trying to get something operational in a hurry for our
agency and I'm not as well prepared as I would like to be.

Mike


John W. Vinson said:
What are the Recordsources of the mainform and the subform?
The Recordsources for the Contacts Form is the contacts table.
The Recordsources for the Session Details subform Calls table. Is that what
you are asking?

What's the
Master/Child Link Field?
The Contacts Table ContactID Field/Calls Table ContactID Field

If it's ContactID, has the mainform's contactID field
been generated at the time you try to insert data?
I'm not sure, but I suspect that is the issue. If I escape out of the notes
field on the subform and switch back to the contacts form and then back
again, it accepts typing in the memo field with no problems. It seems like
the ID hasn't been generated yet. Is there a command to force/refresh this
when I change tabs to the subform automatically?
 
J

John W. Vinson

I'm not sure, but I suspect that is the issue. If I escape out of the notes
field on the subform and switch back to the contacts form and then back
again, it accepts typing in the memo field with no problems. It seems like
the ID hasn't been generated yet. Is there a command to force/refresh this
when I change tabs to the subform automatically?


Normally, if you "dirty" the form at all, the ContactID will be generated. Is
it in fact an Autonumber? If not, how is it being generated? Are you trying to
enter a Note *FIRST* before entering anything about the contact to whom the
note applies? If so... you can't.

The mainform record will be saved at the moment that you set focus to the
subform, automatically. I have no idea what "changing tabs" has to do with it
- tab controls are just visual, they don't affect the logical structure of the
tables or controls, so just changing a tab won't have any effect.
 
S

Stockwell43

Hi Mike,

In the table, do you have that field set up to be "Required"? If it is set
to "yes" then will get that message.

Open your table in design view click on the ContactID and look at the table
at the bottom. the field Required may be set to Yes and if so set it to No if
you do not need this field filled in to save the record and go to the next.
 
M

Mike

John,

I agree with you on this. it's kind of weird. I start to type in the memo
field and get the aformentioned error, escape out of it, go back to the memo
field and can type normally. And subsequently when I move to other tabs and
back to that subform and type in the memo field, it works fine. Only that
first time.

I believe the contact has been created, because if I type any information,
even just a name into the general information tab and exit the application
and come back in, it saved that info, so it seems like the contactID is
generated immediately upon "dirtying" the form at all. It's quite
frustrating. Currently it's the only thing not working, and my users want to
start using the form. UGH!

Thanks for any more advice!

Mike
 
M

Mike

Hi stockwell,

I will try that, however I think I read somewhere that if that is set to no,
users won't be able to see all of the records, which I do want them to be
able to do. I will change that setting and see what happens.

Thanks,

Mike
 
M

Mike

Stockwell,

I went into the calls table and the ContactID field, and changed the
required value to "No". Now, when I click on the memo field subform, I get
this error:

"The changes you requested to the table were not successful because they
would create duplicatevalues in the index, primary key, or relationship.
Change the data in the field or fields that contain duplicate data, remove
the index, or redefine the index to permit duplicate entries and try again."

Any ideas?

Mike
 
M

Mike

One more piece of information, I get the error below when I try to type in
the memo field. If I say "OK" and blank out the data I had typed in the memo
field, and re-enter it, it accepts it just fine. It's the same behavior as
the previous error, if I go out of that field after blanking it out, and
re-enter it, it accepts it just fine. UGH!

Mike
 
F

Fred

This is just sidebar comments from the peanut gallery.

The most common cause I've seen of that new error message is establishing a
blank or default value ina primary key field where such already exists in
another record.
 
S

Stockwell43

Hi Mike,

Are you sure you changed the Required field not the Index field? The
required field only forces the user to input data in a record and not leave
it blank so you don't have a Null value in the field. The Index field keeps
the dups out like in your PK field. for you to get that error you either
changed the wrong field or have something else going on. Hopefully you have
made a copy of your database before trying any of this correct?

Did you try what John suggested? How did that work for you? I see you marked
it as helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top