Re: REQUIRED field(s) in FORMS

Tech-Archive recommends: Fix windows errors by optimizing your registry



The problem is that I have REQUIRED set to YES, but when I test it no errors
arise. What am I doing wrong? I can leave the field blank with no problems
saving the record.
--
smags


"Rick Brandt" wrote:

> smags wrote:
> > I want a field on my FORM to have data REQUIRED to be entered. It's
> > a COMBO BOX with a drop down list of options. I want the user to
> > HAVE TO select one of the options in the drop down box. If the user
> > doesn't select one of the options in the drop down box, then I don't
> > want the user to be able to go to the next field.
> >
> > I went into the TABLE for the field (BENEFICIARYNAME). The DATA TYPE
> > under the field BENEFICIARYNAME says "text," yet I have it as a COMBO
> > BOX for the FORM (I don't know if that matters...the form displays
> > the info I need). Anyhow, I changed the REQUIRED line to read YES.
>
> Okay so far, but making the field required will only raise an error when the
> user saves the record. They will still be able to tab into and out of the
> ComboBox without making an entry. Once they make an entry though they will not
> be allowed to clear it and if they don't make a selection they will not be able
> to leave the record or close the form without cancelling the record or making an
> entry in the Required field. This is the recommended approach to take.
>
> > In the FORM, the COMBO BOX has the CONTROL SOURCE as BENEFICIARYID,
> > not BENEFICIARYNAME (yet the info displayed is the NAME and not the
> > ID). The ROW SOURCE TYPE is TABLE/QUERY and the ROW SOURCE is
> > BENEFICIARIES QUERY.
>
> It is very common for ComboBoxes and ListBoxes to display one value while
> storing another. Your current setup is again the correct way to set it up.
>
> >
> > When I go into the BENEFICIARIES QUERY there's no option to make
> > anything REQUIRED.
>
> Correct. Required fields are determined at the Table level and any Qery based
> on the Table will inherit that same rule. The Query is merely a "window" on the
> Table after all.
>
> > Also, while in the TABLE, do I need to do anything with the
> > VALIDATION RULE? I would like an error message displayed if the user
> > does NOT select one of the drop down options.
>
> A Validation rule will not work here for a couple reasons. The error for
> "Required" would fire before the validation rule anyway and validation rules
> only kick in when the user actually enters something, not when they fail to do
> so. The built in error message for a missing Required field is pretty easy to
> understand, but if you wanted a custom one you could check for problems in the
> BeforeUpdate event of the form and display any message you want.
>
> --
> I don't check the Email account attached
> to this message. Send instead to...
> RBrandt at Hunter dot com
>
>
>
>
.



Relevant Pages

  • Re: REQUIRED field(s) in FORMS
    ... > under the field BENEFICIARYNAME says "text," yet I have it as a COMBO ... A Validation rule will not work here for a couple reasons. ... The built in error message for a missing Required field is pretty easy to ... BeforeUpdate event of the form and display any message you want. ...
    (microsoft.public.access.gettingstarted)
  • Re: Validation Rule question
    ... you can set the Validation Rule of the field in table design ... The error message you describe makes sense if you consider that Access has ... so it is worth the effort to explicitly force a save before ... > the specified record." ...
    (microsoft.public.access.forms)
  • Re: Required Fields in a Form
    ... A safe alternative might be to use the Validation Rule of the table, ... In table design view, open the Properties box, and locate the ... > open a multitude of oppurtunities for data integrity to be violated. ... >> error message, if the required fields have not all been filled in. ...
    (microsoft.public.access.formscoding)
  • Re: ACC: How to Display Line Numbers on Subform Records
    ... The composite PK (uses ID and Aneurism) I would think prevents non-unique ... field and that that strange error message was trapping it. ... conditional logic wrapped inside the validation rule + msgbox is the way to ... ID and Reviewer). ...
    (microsoft.public.access.formscoding)
  • Re: How To Change default error messages
    ... I know how to use the validation rule for validation text but this ... First code the Form's Error event: ... The message box will display the error number and the default error ... go back to the error event and change that code to: ...
    (microsoft.public.access.forms)