Re: Make form field required

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: Subform Required Fields
    ... Instead of setting the Required property of each field, set a Validation ... Open the table in design view. ... Allen Browne - Microsoft MVP. ...
    (microsoft.public.access.forms)
  • Re: required fields question
    ... are telling me that the macro "Sumbit" has not been executed. ... i.e Validation text box appears, click OK and you are returned ... > Instead of setting the Required property of the field to Yes, ... > Steve Schapel, Microsoft Access MVP ...
    (microsoft.public.access.gettingstarted)
  • Re: VALIDATION RULE PROBLEMS WITH AN ACCESS 2000 UPDATE QUERY
    ... Then can you set the Required property for that field in the table (table ... design view) to No? ... > I still get validation errors that block the appending of records. ... > drop the null field from the append query or hard code it to a character ...
    (microsoft.public.access.queries)
  • [Iwls] DATE 2012 - D3 Simulation and Validation
    ... TOPIC D3: "Simulation and Validation" ... DESIGN AUTOMATION AND TEST IN EUROPE CONFERENCE ...
    (comp.parallel)
  • Re: data scaling and validation for learning classifier
    ... My definitions of validation and testing are ... the standard in neural network design (See the ... Test = Current Nondesign + Future Nondesign ... your best design or fold your tent. ...
    (sci.stat.math)