Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Leslie Pollak Leslie Pollak is offline
external usenet poster
 
Posts: 11
Default Form VBA code for checking fields

Hi,
I am using Word 2003.
On one of my forms, I have the following:
Existing Open ECN? No Yes (with a check box beside 'No' and 'Yes')
Existing ECN #: (Field to enter ENC number)
I need some sort of validation code on these thre fields.

Situation 1
------------
If the 'No' checkbox is checked then the 'YES' checkbox cannot be checked
and no data should be entered into the 'Existing ECN #:' field.

Situation 2
------------
If the 'Yes' checkbox is checked then the 'No' checkbox cannot be checked
and data has to be entered into the 'Existing ECN #:' field.

Would the code be easier if I used a drop down form field for the 'Yes/No'
instead of two separate checkbox fields?

Thanks
Leslie
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Form VBA code for checking fields

Yes, the code would be easier with a dropdown. You wouldn't have to worry
about the exclusivity of the checkboxes (see
http://www.word.mvps.org/FAQs/TblsFl...FmFldChbxs.htm for the
kind of mess that can cause).

With the dropdown, the logic is fairly easy:

If the dropdown shows "Yes" and the text field is empty, display an error.
If the dropdown shows "No" and the text field is not empty, display an
error.
Otherwise, proceed.

This logic should be called from macros that override the Save, Save As,
FilePrint, and FilePrintDefault commands. It's trickier to catch the case
where the user closes the form and Word then asks whether to save the
changes, because the events happen in the wrong order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Leslie Pollak wrote:
Hi,
I am using Word 2003.
On one of my forms, I have the following:
Existing Open ECN? No Yes (with a check box beside 'No' and
'Yes') Existing ECN #: (Field to enter ENC number)
I need some sort of validation code on these thre fields.

Situation 1
------------
If the 'No' checkbox is checked then the 'YES' checkbox cannot be
checked and no data should be entered into the 'Existing ECN #:'
field.

Situation 2
------------
If the 'Yes' checkbox is checked then the 'No' checkbox cannot be
checked and data has to be entered into the 'Existing ECN #:' field.

Would the code be easier if I used a drop down form field for the
'Yes/No' instead of two separate checkbox fields?

Thanks
Leslie



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell checking protected form Anthony[_2_] Microsoft Word Help 7 September 19th 07 04:15 AM
Spell checking form fields Liz Montereo Microsoft Word Help 1 August 16th 06 09:31 AM
Is it possible to use spelling and grammar checking in fields? Chief Bob Microsoft Word Help 5 February 14th 06 02:42 PM
spell checking a locked form Scott Microsoft Word Help 1 November 19th 05 01:26 AM
enable spell checking of form fields in Word 2000? Burkett Microsoft Word Help 3 March 25th 05 09:34 PM


All times are GMT +1. The time now is 02:38 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"