Clear All Text Boxes on Form (1 Viewer)

TheSearcher

Registered User.
Local time
Today, 03:47
Joined
Jul 21, 2011
Messages
304
MajP - The funny thing is that as soon as I get the error the option group is cleared - so it would work just fine if it didn't produce an error. I can work around this by setting all the options to 0 individually but I was hoping I could do this in a more efficient manner.
Pat - Thanks for chipping in. I've been clearing controls using the zero length string for about twenty years. I never use bound controls so perhaps that's why it never caused a problem.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 03:47
Joined
May 21, 2018
Messages
8,605
MajP - The funny thing is that as soon as I get the error the option group is cleared - so it would work just fine if it didn't produce an error. I can work around this by setting all the options to 0 individually but I was hoping I could do this in a more efficient manner
Like I said only tag the option group frame. I am not sure how much clearer you want me to make it. Do not mess with the individual options. What part of that do you not understand?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:47
Joined
Feb 19, 2002
Messages
43,478
I never use bound controls
Therein lies your problem. You are accepting all the bad things about Access like its difficulty to distribute, its huge footprint, its lack of a web interface, its limited functionality but eschewing for some reason, the primary reason FOR using Access - bound forms and reports.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 03:47
Joined
May 21, 2018
Messages
8,605
I've been clearing controls using the zero length string for about twenty years. I never use bound controls so perhaps that's why it never caused a problem.
If you think about this logically it makes no sense to make it ZLS and not null. There is almost no way to have an "empty" control be a ZLS unless you do it through code or an import from another source. An "empty" control defaults to Null and there is no way through the GUI to make it ZLS. So you are forcing a ZLS when it does not belong. If you open a blank record those fields are NULL. If you enter a value and then delete the value it is NULL and not ZLD. So IMO it is putting a square peg in a round hole.
 

TheSearcher

Registered User.
Local time
Today, 03:47
Joined
Jul 21, 2011
Messages
304
Pat: That is correct.
MajP: I am a stupid man. I am an idiot. What didn't you think I understood?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 03:47
Joined
May 21, 2018
Messages
8,605
MajP: I am a stupid man. I am an idiot. What didn't you think I understood?
Sorry I was not suggesting anyone was in any way not smart. I just foot stomped in thread 18 that you need to change the value of the option group and not the individual options. So you must only tag the frame and not the options. In thread 19 I explained in detail why this is. An option button inside an option group does not have a value property so you cannot try to change it without receiving an error. You already saw what happens if your try.
However, I added one line to it to deselect toggle buttons within an option group and now I'm getting the "2448 You can't assign a value to this object. In Clear Controls" error.
But after my explanation you stated
I can work around this by setting all the options to 0 individually but I was hoping I could do this in a more efficient manner.
But as I explained in 19 this is impossible.

So the thing I am guessing you did not understand was to Only Tag the frame of the option group and not any option.
 
Last edited:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 08:47
Joined
Jul 9, 2003
Messages
16,360
This is interesting. The properties of an option are different inside an option group versus outside.

Yes, I noticed this too. See Here:-

 

Users who are viewing this thread

Top Bottom