docmd.gotocontrol yellow mark

dejanc

Registered User.
Local time
Today, 15:56
Joined
Aug 4, 2009
Messages
45
Hello all,

I have create a code for form field IME, for validation data if field is empty. So, my wish is, if field is empty > then message box turn on > press ok > and go to control field IME.

Please help!
thanks in advance to helpers...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me.ime, "") = "" Then
MsgBox "Field IME must not be empty", vbCritical + vbOKOnly, "Empty Field!"
Cancel = True
DoCmd.GoToControl ime
End If
End Sub
 
How about using
Me.IME.Setfocus

Or something like that? Not 100% proof on the syntax at the moment
 
Thanks NAMLIAM, it works.

Just two things I would like to get help from you. After press Msgbox OK button, I get next Msgbox with message "No current record".
How to clear that Msgbox?

And, of course I have more fields, which must have validation data field. How can I continue writing code also for another fields?

thanks in advance...
 
Easiest is to make the validation on your table not the form... by setting "allow null" to false.
 
You mean in the field properties of table?
Like validation rule and validation text option?
 

Users who are viewing this thread

Back
Top Bottom