Setting Text Box Width w/VB-Code

  • Thread starter Thread starter TForward
  • Start date Start date
T

TForward

All,

I have a form that displays integer totals from a non-updateable query in
text fields on a form. The text boxes are meant to change width based on
the integer within the field, like a bar chart (well, it IS a bar chart).
I have a macro that does what I want but I need to name all my objects
specifically. I tried vb-coding the on-current event and looping through
the text box collection but I get type-mismatch errors whether I assign the
integer value to variable or name it specifically. If I put an integer in
its place, it works but all my fields come up the same size. The examples
I found online look pretty easy but I must be missing some detail. Can
anyone help? Thanks.

TForward
 
T,
I'm not sure what you're trying to do here. I understand the box widths
realted to the value they hold, but I don't understand...Do you mean the Text Control Captions, or the names of the Text Controls
themselves.
I think you mean the latter, and I don't quite understand why you would do
that.

Wouldn't you Caption the fields with (ex.) Value1, Value2, Value3... and
just put the associated value right in the Text Control itself, and also
leave the Text Control names as Value1, Value2, etc...?
Roughly, like this...
____________________________
Value1: | 97.45 |
--------------------------------------
__________________
Value2: | 63.76 |
------------------------

Could you give a little more detail as to what your doing AND show the code
your using?

Thanks
Al Camp
 
I found what I was doing wrong, so now it works perfectly. It is a form
that displays totals and counts from a group-query and uses the on-current
event to set the width of those text fields equal to the value contained
within. Basically it's a dynamicaly created bar chart that updates with
each record. I created a macro that worked but it forced me to call all
those boxes explicitly in order to resize them. What a pain! When I tried
using vb to loop through the textbox collection I was trying to manipulate
the wrong object. Caught my error, works great now. Thanks.
 
Back
Top