WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Data validation form dynamically created textboxes

 
   Home -> Office -> User Forms RSS
Next:  User Forms: Require a checkbox  
Author Message
edamron

External


Since: May 08, 2008
Posts: 5



(Msg. 1) Posted: Thu Jun 19, 2008 2:32 pm
Post subject: Data validation form dynamically created textboxes Add to elertz
Archived from groups: microsoft>public>word>vba>userforms (more info?)

Wow. It's hard to express just how frustrated I am without using
obscenities. It seems like the designer's of Word VBA sat down and
put their heads together in order to ensure that dynamically created
controls didn't expose any events needed to make them useful.

Well done guys. Mission accomplished!

Okay, with that rant out of the way, I'll ask a question and maybe
someone can help me come up with a way to get around the limitations
of Word 97 VBA.

I have a form that absolutely requires that I dynamically create
controls. (No making controls invisible and visible when needed.).
My users like it when a textbox containing a date converts the date
from a numerical representation to a string. i.e. 06/19/2008 becomes
June 19, 2008.

In the past I've used the BeforeUpdate event of the textbox to call a
sub that does this. However the creators of VBA in there infinite
wisdom didn't expose that event. I just can't believe these guys
didn't think about data validation with regards to dynamically created
textboxes!

Is there a work around? Thanks.
Back to top
Login to vote
edamron

External


Since: May 08, 2008
Posts: 5



(Msg. 2) Posted: Fri Jun 20, 2008 8:55 am
Post subject: Re: Data validation form dynamically created textboxes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jun 20, 1:37 am, "Doug Robbins - Word MVP"
<d... RemoveThis @REMOVECAPSmvps.org> wrote:
> See the thread "Naming a control on a userform runtime error" in this group.
> You should be able to make use of the information in that thread to achieve
> what you are after.
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "edamron" <edam... RemoveThis @spamcop.net> wrote in message
>
> news:47e07f19-ca67-479e-b656-f2f97d5e104b@w8g2000prd.googlegroups.com...
>
>
>
> > Wow.  It's hard to express just how frustrated I am without using
> > obscenities.  It seems like the designer's of Word VBA sat down and
> > put their heads together in order to ensure that dynamically created
> > controls didn't expose any events needed to make them useful.
>
> > Well done guys.  Mission accomplished!
>
> > Okay, with that rant out of the way, I'll ask a question and maybe
> > someone can help me come up with a way to get around the limitations
> > of Word 97 VBA.
>
> > I have a form that absolutely requires that I dynamically create
> > controls.  (No making controls invisible and visible when needed.).
> > My users like it when a textbox containing a date converts the date
> > from a numerical representation to a string.  i.e. 06/19/2008 becomes
> > June 19, 2008.
>
> > In the past I've used the BeforeUpdate event of the textbox to call a
> > sub that does this.  However the creators of VBA in there infinite
> > wisdom didn't expose that event.  I just can't believe these guys
> > didn't think about data validation with regards to dynamically created
> > textboxes!
>
> > Is there a work around?  Thanks.- Hide quoted text -
>
> - Show quoted text -

I guess I'm too dense to understand the relevance of that thread. I
do not have a problem naming the control and indeed do so as described
in the thread.

What I have a problem with is the fact that dynamically created
controls only expose a small (and mostly useless) subset of events.

I may be able to fake up the BeforeUpdate event by trapping the
KeyPress event and testing for a tab or enter and of course the mouse
click in other TextBoxes. Basically I'll have to find a way to test
for anything that moves the focus out of the TextBox being edited.

If I'm missing something in the thread you pointed to please let me
know. I am looking for the best solution to this problem.

Thanks for your help.
Back to top
Login to vote
Jean-Guy Marcil

External


Since: Feb 18, 2008
Posts: 337



(Msg. 3) Posted: Fri Jun 20, 2008 10:00 am
Post subject: Re: Data validation form dynamically created textboxes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"edamron" wrote:

>
> I guess I'm too dense to understand the relevance of that thread. I
> do not have a problem naming the control and indeed do so as described
> in the thread.
>
> What I have a problem with is the fact that dynamically created
> controls only expose a small (and mostly useless) subset of events.
>
> I may be able to fake up the BeforeUpdate event by trapping the
> KeyPress event and testing for a tab or enter and of course the mouse
> click in other TextBoxes. Basically I'll have to find a way to test
> for anything that moves the focus out of the TextBox being edited.
>
> If I'm missing something in the thread you pointed to please let me
> know. I am looking for the best solution to this problem.

See these two threads for a possible solution:
http://tinyurl.com/5h6qyl
or
http://tinyurl.com/3lhk69
Back to top
Login to vote
Jean-Guy Marcil

External


Since: Feb 18, 2008
Posts: 337



(Msg. 4) Posted: Fri Jun 20, 2008 11:50 am
Post subject: RE: Data validation form dynamically created textboxes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"edamron" wrote:

> Wow. It's hard to express just how frustrated I am without using
> obscenities. It seems like the designer's of Word VBA sat down and
> put their heads together in order to ensure that dynamically created
> controls didn't expose any events needed to make them useful.
>
> Well done guys. Mission accomplished!

Don't forget that VBA is a waterdowned version of VB itself, especially the
userform part. So it is not fair to expect it to be just the same. People
who need events for dynamically created controls on userforms represent
probably less than 1% of people who use VBA, and those represents less than
25% of people who use Word, probably even less...

> Okay, with that rant out of the way, I'll ask a question and maybe
> someone can help me come up with a way to get around the limitations
> of Word 97 VBA.
>
> I have a form that absolutely requires that I dynamically create
> controls. (No making controls invisible and visible when needed.).
> My users like it when a textbox containing a date converts the date
> from a numerical representation to a string. i.e. 06/19/2008 becomes
> June 19, 2008.
>
> In the past I've used the BeforeUpdate event of the textbox to call a
> sub that does this. However the creators of VBA in there infinite
> wisdom didn't expose that event. I just can't believe these guys
> didn't think about data validation with regards to dynamically created
> textboxes!

I did reply earlier, but now, over one hour later, my post doesn't show up
(It normally takes a few minutes at most)...

So here it goes oagain...

See if these threads can be of assistance:

http://tinyurl.com/5h6qyl

http://tinyurl.com/5uunpr
Back to top
Login to vote
Doug Robbins - Word MVP

External


Since: Jul 14, 2006
Posts: 4779



(Msg. 5) Posted: Fri Jun 20, 2008 6:37 pm
Post subject: Re: Data validation form dynamically created textboxes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

See the thread "Naming a control on a userform runtime error" in this group.
You should be able to make use of the information in that thread to achieve
what you are after.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"edamron" <edamron.DeleteThis@spamcop.net> wrote in message
news:47e07f19-ca67-479e-b656-f2f97d5e104b@w8g2000prd.googlegroups.com...
> Wow. It's hard to express just how frustrated I am without using
> obscenities. It seems like the designer's of Word VBA sat down and
> put their heads together in order to ensure that dynamically created
> controls didn't expose any events needed to make them useful.
>
> Well done guys. Mission accomplished!
>
> Okay, with that rant out of the way, I'll ask a question and maybe
> someone can help me come up with a way to get around the limitations
> of Word 97 VBA.
>
> I have a form that absolutely requires that I dynamically create
> controls. (No making controls invisible and visible when needed.).
> My users like it when a textbox containing a date converts the date
> from a numerical representation to a string. i.e. 06/19/2008 becomes
> June 19, 2008.
>
> In the past I've used the BeforeUpdate event of the textbox to call a
> sub that does this. However the creators of VBA in there infinite
> wisdom didn't expose that event. I just can't believe these guys
> didn't think about data validation with regards to dynamically created
> textboxes!
>
> Is there a work around? Thanks.
Back to top
Login to vote
Doug Robbins - Word MVP

External


Since: Jul 14, 2006
Posts: 4779



(Msg. 6) Posted: Sat Jun 21, 2008 3:03 am
Post subject: Re: Data validation form dynamically created textboxes Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I was figuring that if you know the name of the control, you could make use
of it in a validation routine that was run from a command button on the form
before that button did the rest of its thing.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"edamron" <edamron.RemoveThis@spamcop.net> wrote in message
news:b4066799-806c-421c-b80d-f0e5f442a023@q24g2000prf.googlegroups.com...
On Jun 20, 1:37 am, "Doug Robbins - Word MVP"
<d....RemoveThis@REMOVECAPSmvps.org> wrote:
> See the thread "Naming a control on a userform runtime error" in this
> group.
> You should be able to make use of the information in that thread to
> achieve
> what you are after.
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "edamron" <edam....RemoveThis@spamcop.net> wrote in message
>
> news:47e07f19-ca67-479e-b656-f2f97d5e104b@w8g2000prd.googlegroups.com...
>
>
>
> > Wow. It's hard to express just how frustrated I am without using
> > obscenities. It seems like the designer's of Word VBA sat down and
> > put their heads together in order to ensure that dynamically created
> > controls didn't expose any events needed to make them useful.
>
> > Well done guys. Mission accomplished!
>
> > Okay, with that rant out of the way, I'll ask a question and maybe
> > someone can help me come up with a way to get around the limitations
> > of Word 97 VBA.
>
> > I have a form that absolutely requires that I dynamically create
> > controls. (No making controls invisible and visible when needed.).
> > My users like it when a textbox containing a date converts the date
> > from a numerical representation to a string. i.e. 06/19/2008 becomes
> > June 19, 2008.
>
> > In the past I've used the BeforeUpdate event of the textbox to call a
> > sub that does this. However the creators of VBA in there infinite
> > wisdom didn't expose that event. I just can't believe these guys
> > didn't think about data validation with regards to dynamically created
> > textboxes!
>
> > Is there a work around? Thanks.- Hide quoted text -
>
> - Show quoted text -

I guess I'm too dense to understand the relevance of that thread. I
do not have a problem naming the control and indeed do so as described
in the thread.

What I have a problem with is the fact that dynamically created
controls only expose a small (and mostly useless) subset of events.

I may be able to fake up the BeforeUpdate event by trapping the
KeyPress event and testing for a tab or enter and of course the mouse
click in other TextBoxes. Basically I'll have to find a way to test
for anything that moves the focus out of the TextBox being edited.

If I'm missing something in the thread you pointed to please let me
know. I am looking for the best solution to this problem.

Thanks for your help.
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> User Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET