Index or primary key cannot contain a Null value

  • Thread starter gmazza via AccessMonster.com
  • Start date
G

gmazza via AccessMonster.com

Hi there,
I have a form and when I navigate through the records life is good. When I
navigate to a new record, I can enter info and it saves to the table and all
is good.
When I navigate to a new record and I didn't mean to, I click back to the
previous record and this error comes up. I don't want this error to come up,
I just want to goto the previous record as I didn't mean to create a new
record but it errors as its pissed that I am not entering key values for the
table.
Anyway I can bypass this and go back to the previous record?
Thanks!
 
D

Dirk Goldgar

gmazza via AccessMonster.com said:
Hi there,
I have a form and when I navigate through the records life is good. When I
navigate to a new record, I can enter info and it saves to the table and
all
is good.
When I navigate to a new record and I didn't mean to, I click back to the
previous record and this error comes up. I don't want this error to come
up,
I just want to goto the previous record as I didn't mean to create a new
record but it errors as its pissed that I am not entering key values for
the
table.
Anyway I can bypass this and go back to the previous record?
Thanks!


If I understand you correctly, it sounds like you have code, probably in
your form's Current event, that is dirtying the new record by setting the
value of some field. If so, you need to change or remove that code, so that
a new record isn't automatically dirtied.
 
M

Marshall Barton

gmazza said:
I have a form and when I navigate through the records life is good. When I
navigate to a new record, I can enter info and it saves to the table and all
is good.
When I navigate to a new record and I didn't mean to, I click back to the
previous record and this error comes up. I don't want this error to come up,
I just want to goto the previous record as I didn't mean to create a new
record but it errors as its pissed that I am not entering key values for the
table.
Anyway I can bypass this and go back to the previous record?


Sure. your problem is probably (can't tell because you did
not say what error) that the new record was dirtied. Either
you started to enter something in the new record or you have
code that set a value in the new record. Any changes to the
new record must be undone if you change you mind about
starting a new record. You can either hit the Escape key
twice or use some other mechanism to run the line of code;
Me.Undo
 

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