Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Spell checking protected form | Microsoft Word Help | |||
Spell checking form fields | Microsoft Word Help | |||
Is it possible to use spelling and grammar checking in fields? | Microsoft Word Help | |||
spell checking a locked form | Microsoft Word Help | |||
enable spell checking of form fields in Word 2000? | Microsoft Word Help |