On 19 Jan 2006 06:40:15 -0800, "steph" <st*******@gmx.net> wrote:
Hello,
I've got a text field in an access form (Microsoft Access 2002, SP3),
that the user has to fill out. Now I don't want the user to leave this
field (and this record) until he has filled out the field (which is
stored in a table) correctly.
What's the best way to achieve this?
thanks,
stephan
In the BeforeUpdate event of the control put -
If Len(Trim(Me.FieldName)) & vbNullString = 0 Then
Msgbox "You must enter a value for FieldName.",vbInformation & vbOKOnly,"Entry Required"
Cancel = True
End If
The BeforeUpdate event of the control will stop the user leaving the control until data is entered.
In the underlying table set the "Required" property of the field to Yes. This will stop the record being saved if data
is not entered in the field. In the form, this will prevent them leaving the record until the data has been entered.
Wayne Gillespie
Gosford NSW Australia