two problems with mandatory fields in forms

  • Thread starter Thread starter harpunero
  • Start date Start date
H

harpunero

Guest
Hi,

I am experiencing a few problems with mandatory fields in my forms. I use different forms which all base on the same table - therefore I can not use the "Required"-flag in the table definitions.

What I managed to do by now:
I put this statement into the OnExit-Event:
=IIf([FMNO] Is Null,MsgBox("Please enter the FMNO",48,"Error Message"),"")

This provides me with an errormessage in case the field is null.
When I exit the field, I receive the errormessage but the cursor moves to the next field. How can I make sure that the cursor stays in the field where the error occurs?


My next problem:
When I try to use this syntax on a text-field (e.g. "NAME") it doesn't work.

Has anybody any suggestions?

Your help is very much appreciated, I'm getting more and more desperate on this issue.
 
Write the Form's on close event so that it checks the value and if null throw back an error and have the user correct it.

Sub Form OnClose()
If is null(FMNO) = True Then
msgBox "Please enter the FMNO"
Exit Sub
Else
Docmd.Close
End Sub
 

Users who are viewing this thread

Back
Top Bottom