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

How to prevent a non-entry in a field.

P: n/a
I want to have a memo field on a form which it is mandatory to make a
comment in. My problem is that people often don't want to fill this in and
I believe that they are simply hitting the space bar a couple of times and
there is basically no comment saved, but it fills the requirements for
Access to save the record. I know that theoretically, they can enter any
goobledee gook they like as in 'asdhfladsfhd', but that is unlikely. Is
there a way that I can say in VBA, if the comment is made up of only space
bar keys then carry out an action?

dixie
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
dixie wrote:
I want to have a memo field on a form which it is mandatory to make a
comment in. My problem is that people often don't want to fill this in and
I believe that they are simply hitting the space bar a couple of times and
there is basically no comment saved, but it fills the requirements for
Access to save the record. I know that theoretically, they can enter any
goobledee gook they like as in 'asdhfladsfhd', but that is unlikely. Is
there a way that I can say in VBA, if the comment is made up of only space
bar keys then carry out an action?

dixie


Sub Form BeforeUpdate(Cancel As Integer)
If Len(Trim(Nz(MyTextBox,"")))=0 then
MyTextBox.SetFocus
If isnull(MyTextBox) Then
Msgbox "Please fill in this", vbInformation
Else
Msgbox "Oi Numpty, think you can fool me eh?", vbExclamation
Msgbox "Try that again sunshine and I'll wipe all your data!"
End If
Cancel = True
End if
End Sub

--
This sig left intentionally blank
Nov 13 '05 #2

P: n/a
Trevor Best wrote:
dixie wrote:
I want to have a memo field on a form which it is mandatory to make a
comment in. My problem is that people often don't want to fill this
in and I believe that they are simply hitting the space bar a couple
of times and there is basically no comment saved, but it fills the
requirements for Access to save the record. I know that
theoretically, they can enter any goobledee gook they like as in
'asdhfladsfhd', but that is unlikely. Is there a way that I can say
in VBA, if the comment is made up of only space bar keys then carry
out an action?

dixie


Sub Form BeforeUpdate(Cancel As Integer)
If Len(Trim(Nz(MyTextBox,"")))=0 then
MyTextBox.SetFocus
If isnull(MyTextBox) Then
Msgbox "Please fill in this", vbInformation
Else
Msgbox "Oi Numpty, think you can fool me eh?", vbExclamation
Msgbox "Try that again sunshine and I'll wipe all your data!"
End If
Cancel = True
End if
End Sub

You sure can do better edits, as shown above. But in my experience, as
fast as you improve the edit, the users will find workarounds almost as
fast. I believe the best method is to explain why the information is
important.

Bob
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.