Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2006

Tip: Looking for answers? Try searching our database.

capturing checkbox result

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
abbarition - 09 Mar 2006 20:10 GMT
I have macros running on enter and exit of my form fields.  I capture the
result of the form field during both macros and am comparing the two values
to see if the field was changed.  However, if I click into a checkbox, it
changes the result of the checkbox, runs tne exit macro for the previous
field, and then runs the enter macro for the checkbox.  So when it runs the
enter macro, it is capturing the changed result.  Is there a way around this?
Or should I always capture the opposite result on entering a checkbox (false
for true and true for false)?

Thanks in advance!
Cooz - 10 Mar 2006 12:45 GMT
Hi abbarition,

No, you should definitely _not_ capture the opposite result since a user may
use the tab key to navigate between form fields. This way the result does not
change.

I find that when I use the macros below, the exit macro of the previous
field is run, the result of the next field is (not - if the tab key is used)
changed, and the enter macro of the next field is run. Which is the sequence
you want.

Now that I think of it... you state: "if I click into a checkbox, it changes
the result of the checkbox" - in which you click, I presume. But then, that
should be ok, shouldn't it? You for example click to clear a checkbox, and
the enter macro captures the "clear". If you mean that your macros change the
result of the previous checkbox, you are right - that is not what you want.

Anyway, here are mine:

Sub EnterMacro()
   MsgBox Selection.FormFields(1).Name & " " & _
       Selection.FormFields(1).Result, 0, "Enter"
End Sub
Sub ExitMacro()
   MsgBox Selection.FormFields(1).Name & " " & _
       Selection.FormFields(1).Result, 0, "Exit"
End Sub

Good luck,
Cooz
--
PS: If this is a satisfying answer to your question and you're logged in via
the Microsoft site, please click Yes to "Did this post answer the question?".
Thanks.

> I have macros running on enter and exit of my form fields.  I capture the
> result of the form field during both macros and am comparing the two values
[quoted text clipped - 6 lines]
>
> Thanks in advance!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.