Re: Make form field required
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Tue, 24 Jan 2006 22:58:58 +0800
Steve, open your table in design view, and select the field.
Instead of setting its Required property in the lower pane of table design,
set:
Validation Rule: Is Not Null
Validation Text: Oops: Ya need ta enter MyField.
If you really want to do it a the form level instead (e.g. if you want the
user to be able to override the warning and leave it blank anyway), use the
BeforeUpdate event of the *form* to see if the control is null:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
If IsNull(Me.[SomeField]) Then
strMsg = "SomeField is still blank." & vbCrLf & _
" Continue anyway?"
If MsgBox(strMsg, vbYesNo+vbDefaultButton2) = vbNo Then
Cancel = True
End If
End If
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Shek5150" <Shek5150@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BF3DFFA8-EB03-4986-B2B7-5DD1616D47B0@xxxxxxxxxxxxxxxx
> Greetings,
>
> I have several fields on a form that need to be required and not permit
> the
> user to leave blank Therefore, I need the user to make a selection from
> the
> dropdown list.
>
> p.s., I've tried to adjust the respective field properties (required, Val
> Rule/Text) in both the table/form. However, when I use the table's field
> properties...I don't get the validation text that I'd like...I get the
> computers standard blah, blah, blah...when I use the form's field
> properties...the user is able to skip right past the required
> field...(that
> being said, if they tab into the field then my desired validation text
> pops
> up)...but I can't allow them to just skip it...
>
> Hope I communicated my situation clearly...it seems to be more clear in my
> head then when I see it on the screen in front of me....
>
> Any help would be appreciated....
>
> v/r
> Steve
.
- Prev by Date: Re: Getting Rid of Graphic Reference
- Next by Date: Re: lookup and entry form
- Previous by thread: Selecting an DBMS
- Next by thread: Re: Make form field required
- Index(es):
Relevant Pages
|