Need field to be a mandatory fill

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I need to make a field a mandatory fill. I am using access 2000.
I have tried on the before update event
If Is Null (Me.Class) Then
Cancel = True
MsgBox "Class Field must be completed"
End If

The problem seems to be in the (Me.Class)

It worked ok in a database on an machine that had Access 97 on it.

I also get a similar problem trying to set focus onto a field when add a new
record is selected.

I tried
Private Sub Form_Current()
If Me.Newrecord Then Me.Reference.SetFocus
End Sub

Any help pointing a novice in the right direction would be appriciated.
Thanks

Steve
 
Please see my comments inline ...

Steve M said:
Hi

I need to make a field a mandatory fill. I am using access 2000.
I have tried on the before update event
If Is Null (Me.Class) Then
Cancel = True
MsgBox "Class Field must be completed"
End If

That should be:

If IsNull (Me.Class) Then
Cancel = True
MsgBox "Class Field must be completed"
End If
The problem seems to be in the (Me.Class)

It worked ok in a database on an machine that had Access 97 on it.

Not the way you posted it, I don't think.
I also get a similar problem trying to set focus onto a field when
add a new record is selected.

I tried
Private Sub Form_Current()
If Me.Newrecord Then Me.Reference.SetFocus
End Sub

Code like that seems to work fine for me. Are you getting any error
message?
 
Back
Top