BeforeInsert Problem

rober1967

New member
Local time
Today, 02:05
Joined
Jun 5, 2010
Messages
5
Hi, I've a problem in the BeforeInsert event of my form Temi.
I putted this validation code:

If IsNull(Me.descrizione) Then
Cancel = True
MsgBox "Descrizione Obbligatoria", vbInformation, "Validazione"
Me.descrizione.SetFocus
Me.Undo
End If

but if I try to fill the field "descrizione" on the form he doesn't permit me to insert nothing....:( and show the Message Box.
Why ?
Attached the project.
 

Attachments

My guess is that it's because it's in the beforeinsert event. Won't it always be null before? Try it in the on current event.
 
My guess is that it's because it's in the beforeinsert event. Won't it always be null before? Try it in the on current event.

You're right in beforeinsert the texbox are null because are not created.
I changed my validation in afterupdate and manage it with a macro.
Thanks.:)
 
I changed my validation in afterupdate and manage it with a macro

That would be the wrong event for validation of records since it's already been committed to table. You should use Before_Update instead, since you can cancel the update in this event.

JR
 
That would be the wrong event for validation of records since it's already been committed to table. You should use Before_Update instead, since you can cancel the update in this event.

JR

Yes, you're right. I made it, now it work like a charm..Thank you. :)
 

Users who are viewing this thread

Back
Top Bottom