By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,407 Members | 2,842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,407 IT Pros & Developers. It's quick & easy.

Access Form: lock user on text field ...

P: n/a
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

Jan 19 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
Jan 19 '06 #2

P: n/a
Thanks for the answer. My problem is, though, that the underlying table
in linked in from an Oracle database and the column can't be set to
required.

Jan 20 '06 #3

P: n/a
On 20 Jan 2006 02:46:15 -0800, "steph" <st*******@gmx.net> wrote:
Thanks for the answer. My problem is, though, that the underlying table
in linked in from an Oracle database and the column can't be set to
required.


Then put the same code on the BeforeUpdate event of the form as well as the control.

If Len(Trim(Me.FieldName)) & vbNullString = 0 Then
Msgbox "You must enter a value for FieldName.",vbInformation & vbOKOnly,"Entry Required"
Cancel = True
End If

This will prevent the record being saved if the data is not entered.

Wayne Gillespie
Gosford NSW Australia
Jan 20 '06 #4

P: n/a
thanks,

this works!

Jan 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.