capture new record addition

M

mleczko

Hi,

How can I capture the fact the someone has started enteringt a new
record and wants to move to another record without populating a primary
key field.

My users keep getting the 'primary key or index cannot be null' error
and it's a little frustrating

I want them to be returned to the mandatory key field before they move
on

Thanks
Nick
 
G

Guest

If you're not using an autonumber, you could trap for the mistake in the
form's BeforeInsert event. In this event, put:

If IsNull(Me.MyPrimaryField) Then
MsgBox "Primary field cannot be blank",vbbOkOnly,"Error"
Cancel = True
End If

Barry
 

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