Re: Mandatory Fields

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



This can be done, but I recommend against it. What if the person selects the
option by mistake then tries to change it to Yes or No? You have now
prevented them from doing anything except filling in the textbox, which is
actually no longer applicable because they are trying to choose Yes or No.
Yes, the could press Esc to cancel the record, but then they get to start
all over again.

The best way is to make them fill in the textbox prior to saving the record.
To do this, use the form's BeforeUpdate event. Check the value of the option
and if it is the "unable..." option, check the value of the textbox to see
if an entry has been made. If not, Cancel the update, use a MsgBox to advise
the user of the problem, and set the focus to the textbox.

--
Wayne Morgan
MS Access MVP


"MannyD" <MannyD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8851311A-BFFC-46CD-AEFF-92439996DC6D@xxxxxxxxxxxxxxxx
> I'm trying to create an Access form that, when a person checks an 'unable
> to
> determine' checkbox, Access will prevent the user from proceeding with the
> form until they explain in an adjacent text box why they selected 'unable
> to
> determine'. If the user selects from the other two options (yes or no),
> they
> do not need to fill out the text box.
>
> Any ideas (hopefully an easy solution!)?
>
> Thanks!
>


.



Relevant Pages

  • Re: Cancel Form and Hopelessly Lost Again
    ... All that setting the Cancel property on the button really does is make ... True cancels the event (stops the user leaving the textbox, ... tidy up events occur - in your case, the textbox exit and, perhaps, others. ... anyway) because the textbox is in a Frame. ...
    (microsoft.public.word.vba.userforms)
  • Re: If statement with a Null
    ... In the first instance, you are checking to see if ... Private Sub txtDeductibleCreditsStartDate_Exit(ByVal Cancel As ... You only need one 'If' statement to check the value of the TextBox ... and a search of the VBA help only returned 3 topics - ...
    (microsoft.public.word.vba.general)
  • Re: If statement with a Null
    ... help and explanations. ... Private Sub txtDeductibleCreditsStartDate_Exit(ByVal Cancel As ... You only need one 'If' statement to check the value of the TextBox ... I don't know why that website would 'Null' in Word VBA examples; ...
    (microsoft.public.word.vba.general)
  • RE: Exit event/textbox/frame
    ... it continued on and executed the exit event for textbox1. ... Private Sub Frame1_Exit(ByVal Cancel As MSForms.ReturnBoolean) ... Private Sub TextBox1_Exit ... 'This is 1st textbox in Frame1 ...
    (microsoft.public.excel.programming)
  • RE: Exit event on field not firing when exiting a frame
    ... functions to validate the values in the textboxes in the frame ... '*** Use the validation function to set the Cancel argument on Exit from the ... format the value in each textbox on Exit. ... I'm working with the Exit event because I don't want the textbox to ...
    (microsoft.public.word.vba.general)