I'm hoping that this is something simple that I am just overlooking...
I have some forms on which I need to loop through the controls. Everything was working fine until I needed to change one of the controls from a text box to a combo box. When I made this change it changed the order that my loop went through the controls. Because of some other things that I am doing, this has created a bit of an issue for me. It doesn't break the database, but it is causing me a headache.
As an example...
I have a form that has three fields - Grade, Type, Comment - in that order. Originally they were all text boxes and when I looped through them they went in that order which is what I needed. Then I changed "Type" to a combo box. When I did that they then looped through in the order of Grade, Comment, Type - NOT what I need.
I'm using a For Each loop on the controls in the form. When I noticed the problem I added a line that did Debug.Print for the control name on each iteration of the loop.
Originally it spit out:
Grade_Label
Grade
Type_Label
Type
Comment_Label
Comment
Now it gives me:
Grade_Label
Grade
Comment_Label
Comment
Type_Label
Type
If I change Comment to a combo and change it back, it goes back to what the first list was.
I can fix this by changing Comment to a combo box and then back to a text box, but that seems very clumsy and silly. I imagine that in my greater use for this loop I could probably code around it - but that would be a lot of extra work if there is a simple way to fix the root cause.
I've checked the Tab order, but that is all in the correct order. I couldn't find another property of the controls that seemed to govern this, but maybe I overlooked it or it isn't in the box listing all the properties and values.
Does anyone know a good solid way to fix this, or is it something that I'll just have to work around?
I have some forms on which I need to loop through the controls. Everything was working fine until I needed to change one of the controls from a text box to a combo box. When I made this change it changed the order that my loop went through the controls. Because of some other things that I am doing, this has created a bit of an issue for me. It doesn't break the database, but it is causing me a headache.
As an example...
I have a form that has three fields - Grade, Type, Comment - in that order. Originally they were all text boxes and when I looped through them they went in that order which is what I needed. Then I changed "Type" to a combo box. When I did that they then looped through in the order of Grade, Comment, Type - NOT what I need.
I'm using a For Each loop on the controls in the form. When I noticed the problem I added a line that did Debug.Print for the control name on each iteration of the loop.
Originally it spit out:
Grade_Label
Grade
Type_Label
Type
Comment_Label
Comment
Now it gives me:
Grade_Label
Grade
Comment_Label
Comment
Type_Label
Type
If I change Comment to a combo and change it back, it goes back to what the first list was.
I can fix this by changing Comment to a combo box and then back to a text box, but that seems very clumsy and silly. I imagine that in my greater use for this loop I could probably code around it - but that would be a lot of extra work if there is a simple way to fix the root cause.
I've checked the Tab order, but that is all in the correct order. I couldn't find another property of the controls that seemed to govern this, but maybe I overlooked it or it isn't in the box listing all the properties and values.
Does anyone know a good solid way to fix this, or is it something that I'll just have to work around?