![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
"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/ |
#4
| ||||
| ||||
|
|
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. |
#5
| |||
| |||
|
|
"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/ |
#6
| |||
| |||
|
|
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". |
#7
| |||
| |||
|
|
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". |
#8
| |||
| |||
|
|
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? |
![]() |
| Thread Tools | |
| Display Modes | |
| |