dbTalk Databases Forums  

Setting format fires event...

comp.databases.ms-access comp.databases.ms-access


Discuss Setting format fires event... in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Matthew Wells
 
Posts: n/a

Default Setting format fires event... - 08-25-2010 , 11:55 AM






Hello All!

This one has been making me insane. I'm setting the format property of a
textbox to an empty string "" and when I do, it fires the after update event
of another listbox control. The FormatControls function is called from
every form in my app, but this only happens on this one form. It also only
happens on the first control where the format property is set. I've skipped
the first few controls and the event fires on the first called .format = ""
statement - and none after only the first. The function also sets other
properties, but none of them are failing - only .Format = "" on the first
(no matter which I do first) control. It also doesn't' matter if it's a
textbox, listbox, combobox, etc.

I"ve done a compact and repair, a decompile and compile, recreated the form
and controls..

Does anyone know how this is happening?

Thanks.

Matthew Wells
matthew.wells (AT) firstbyte (DOT) net

Reply With Quote
  #2  
Old   
David W. Fenton
 
Posts: n/a

Default Re: Setting format fires event... - 08-25-2010 , 02:00 PM






"Matthew Wells" <matthew.wells (AT) firstbyte (DOT) net> wrote in
news:xWbdo.372$IH1.353 (AT) newsfe18 (DOT) iad:

Quote:
This one has been making me insane. I'm setting the format
property of a textbox to an empty string "" and when I do, it
fires the after update event of another listbox control. The
FormatControls function is called from every form in my app, but
this only happens on this one form. It also only happens on the
first control where the format property is set. I've skipped the
first few controls and the event fires on the first called .format
= "" statement - and none after only the first. The function
also sets other properties, but none of them are failing - only
.Format = "" on the first (no matter which I do first) control.
It also doesn't' matter if it's a textbox, listbox, combobox, etc.
Why are you setting the Format property in code at all, let alone
very time a control is updated? Do you understand the purpose of the
Format property?

I'd say there is no justification for what you are doing, but please
explain what you're trying to achieve.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #3  
Old   
Matthew Wells
 
Posts: n/a

Default Re: Setting format fires event... - 08-25-2010 , 03:01 PM



Sometimes you just have to trust the poster that he/she knows what he/she is
doing. One reason to change the format of a control by code is to set a
number's format based on a user preference that is only known at run time of
how many decimal places to show. That's just one. I'm sure other people
out there have many other reasons. My reason is that I have search
functionality built into my forms that when selected removes all formats,
and after the search results are shown, the formats (and all other
properties) are put back. This is a generic function called by all forms.
I've used it for years without ever having this issue. I never said I
change the format every time I update the control - I said that another
control's event is firing the first time the format is set. So now that
I've answered your judgmental question, you can answer why you have to be so
negative to posters without having a clue as to what's going on?

For those of you who are kind enough to actually try and answer the
question, I forgot to mention that I'm using Access 2007 on Windows 7
Ultimate and Windows XP. The forms are unbound.
Thank you.



"David W. Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote

Quote:
"Matthew Wells" <matthew.wells (AT) firstbyte (DOT) net> wrote in
news:xWbdo.372$IH1.353 (AT) newsfe18 (DOT) iad:

This one has been making me insane. I'm setting the format
property of a textbox to an empty string "" and when I do, it
fires the after update event of another listbox control. The
FormatControls function is called from every form in my app, but
this only happens on this one form. It also only happens on the
first control where the format property is set. I've skipped the
first few controls and the event fires on the first called .format
= "" statement - and none after only the first. The function
also sets other properties, but none of them are failing - only
.Format = "" on the first (no matter which I do first) control.
It also doesn't' matter if it's a textbox, listbox, combobox, etc.

Why are you setting the Format property in code at all, let alone
very time a control is updated? Do you understand the purpose of the
Format property?

I'd say there is no justification for what you are doing, but please
explain what you're trying to achieve.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #4  
Old   
David W. Fenton
 
Posts: n/a

Default Re: Setting format fires event... - 08-26-2010 , 02:14 PM



"Matthew Wells" <matthew.wells (AT) firstbyte (DOT) net> wrote in
news:yEedo.12622$yr6.6758 (AT) newsfe05 (DOT) iad:

Quote:
Sometimes you just have to trust the poster that he/she knows what
he/she is doing. One reason to change the format of a control by
code is to set a number's format based on a user preference that
is only known at run time of how many decimal places to show.
That's just one.
This should happen in the form's OnLoad event, before any data has
been edited. That cannot possibly cause the AfterUpdate event of any
controls to fire.

I will say that I misinterpreted your post to mean you were
repeatedly setting the format property. As of now, it's unclear
whether you're doing it as I suggested (once, in the form's OnLoad
event) or somewhere else.

Quote:
I'm sure other people
out there have many other reasons. My reason is that I have
search functionality built into my forms that when selected
removes all formats, and after the search results are shown, the
formats (and all other properties) are put back.
Why don't you explain why you feel this is necessary.

Quote:
This is a generic function called by all forms.
I've used it for years without ever having this issue. I never
said I change the format every time I update the control - I said
that another control's event is firing the first time the format
is set. So now that I've answered your judgmental question, you
can answer why you have to be so negative to posters without
having a clue as to what's going on?
Your post was extremely vague, which leaves your reader prone to
fill in the blanks on what is left unsaid.

Quote:
For those of you who are kind enough to actually try and answer
the question, I forgot to mention that I'm using Access 2007 on
Windows 7 Ultimate and Windows XP. The forms are unbound.
I'd still like to hear an explanation of why you think it's
necessary to reset the formats for your "search" functionality.

The fact that it has worked in previous versions does not mean it
was ever a good idea, though. But I can't say if it was a good idea
or not, since I don't yet have your explanation of why you're doing
it.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #5  
Old   
Matthew Wells
 
Posts: n/a

Default Re: Setting format fires event... - 10-18-2010 , 07:35 AM



This may have been too long ago, but here it goes:

The part about that it cannot possibly happen on the .format property is why
I am posting here.

As for changing the format property at all, here's a quick example:

You have a user form with FirstName, LastName, DOB. The form has a list box
of all names. The format property of DOB is set to "Short Date". I have a
"Search" button that clears the format (and control source if I used it) so
the user can type in their own criteria. If the format property of DOB is
still set, then a user could not type ">#1/1/2000#" or "Between #1/1/2000#
and #1/31/2000#". After the user enters their criteria, he/she clicks the
"Go" button and I build a Where clause that filters the form's list box of
names. Now the form is ready for data entry - no wait - I have to change
the format of DOB back to "Short Date".






"David W. Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote

Quote:
"Matthew Wells" <matthew.wells (AT) firstbyte (DOT) net> wrote in
news:yEedo.12622$yr6.6758 (AT) newsfe05 (DOT) iad:

Sometimes you just have to trust the poster that he/she knows what
he/she is doing. One reason to change the format of a control by
code is to set a number's format based on a user preference that
is only known at run time of how many decimal places to show.
That's just one.

This should happen in the form's OnLoad event, before any data has
been edited. That cannot possibly cause the AfterUpdate event of any
controls to fire.

I will say that I misinterpreted your post to mean you were
repeatedly setting the format property. As of now, it's unclear
whether you're doing it as I suggested (once, in the form's OnLoad
event) or somewhere else.

I'm sure other people
out there have many other reasons. My reason is that I have
search functionality built into my forms that when selected
removes all formats, and after the search results are shown, the
formats (and all other properties) are put back.

Why don't you explain why you feel this is necessary.

This is a generic function called by all forms.
I've used it for years without ever having this issue. I never
said I change the format every time I update the control - I said
that another control's event is firing the first time the format
is set. So now that I've answered your judgmental question, you
can answer why you have to be so negative to posters without
having a clue as to what's going on?

Your post was extremely vague, which leaves your reader prone to
fill in the blanks on what is left unsaid.

For those of you who are kind enough to actually try and answer
the question, I forgot to mention that I'm using Access 2007 on
Windows 7 Ultimate and Windows XP. The forms are unbound.

I'd still like to hear an explanation of why you think it's
necessary to reset the formats for your "search" functionality.

The fact that it has worked in previous versions does not mean it
was ever a good idea, though. But I can't say if it was a good idea
or not, since I don't yet have your explanation of why you're doing
it.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #6  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Setting format fires event... - 10-18-2010 , 05:58 PM



"Matthew Wells" <matthew.wells (AT) firstbyte (DOT) net> wrote in
news:5aXuo.3030$yw.2214 (AT) newsfe18 (DOT) iad:

Quote:
As for changing the format property at all, here's a quick
example:

You have a user form with FirstName, LastName, DOB. The form has
a list box of all names. The format property of DOB is set to
"Short Date". I have a "Search" button that clears the format
(and control source if I used it) so the user can type in their
own criteria. If the format property of DOB is still set, then a
user could not type ">#1/1/2000#" or "Between #1/1/2000# and
#1/31/2000#". After the user enters their criteria, he/she
clicks the "Go" button and I build a Where clause that filters the
form's list box of names. Now the form is ready for data entry -
no wait - I have to change the format of DOB back to "Short Date".
I would never re-use a criterion textbox like that. Indeed, I'd
never set a format for a criterion textbox. I might set an input
mask, but don't see the point of even bothering with formats.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #7  
Old   
Matthew Wells
 
Posts: n/a

Default Re: Setting format fires event... - 11-09-2010 , 09:22 AM



When it's used as search criteria, the formats are all removed. When the
user applies the search criteria the original formats are restored. I'm
sure many people find formats for dates, times, currency, etc. are quite
useful.

The whole point of the original post was that when I executed the first "set
format" line

txtbox1.format = whatever

that this line fired the Listbox1_AfterUpdate event for no apparent reason.

I've taken out all the search code and left only the set format lines and it
still happens. Do you have an idea why?



"David-W-Fenton" wrote in message
news:Xns9E15C0FEA8F44f99a49ed1d0c49c5bbb2 (AT) 74 (DOT) 209.136.98...

"Matthew Wells" <matthew.wells (AT) firstbyte (DOT) net> wrote in
news:5aXuo.3030$yw.2214 (AT) newsfe18 (DOT) iad:

Quote:
As for changing the format property at all, here's a quick
example:

You have a user form with FirstName, LastName, DOB. The form has
a list box of all names. The format property of DOB is set to
"Short Date". I have a "Search" button that clears the format
(and control source if I used it) so the user can type in their
own criteria. If the format property of DOB is still set, then a
user could not type ">#1/1/2000#" or "Between #1/1/2000# and
#1/31/2000#". After the user enters their criteria, he/she
clicks the "Go" button and I build a Where clause that filters the
form's list box of names. Now the form is ready for data entry -
no wait - I have to change the format of DOB back to "Short Date".
I would never re-use a criterion textbox like that. Indeed, I'd
never set a format for a criterion textbox. I might set an input
mask, but don't see the point of even bothering with formats.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #8  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Setting format fires event... - 11-09-2010 , 03:07 PM



"Matthew Wells" <matthew.wells (AT) firstbyte (DOT) net> wrote in
news:8HdCo.13353$Ou2.10360 (AT) newsfe20 (DOT) iad:

Quote:
When it's used as search criteria, the formats are all removed.
When the user applies the search criteria the original formats are
restored. I'm sure many people find formats for dates, times,
currency, etc. are quite useful.
I'm not disagreeing that formatting for display is not useful. I'm
saying I can't fathom why you'd want to use a single textbox for
multiple types of criteria. To me, that just sounds like asking for
trouble.

Quote:
The whole point of the original post was that when I executed the
first "set format" line

txtbox1.format = whatever

that this line fired the Listbox1_AfterUpdate event for no
apparent reason.

I've taken out all the search code and left only the set format
lines and it still happens. Do you have an idea why?
I haven't a clue. I don't think I've ever set a format in code,
since I set them in the textbox properties.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.