TextBox Width

  • Thread starter Thread starter open a adobe file from a command button
  • Start date Start date
O

open a adobe file from a command button

I'm using the following code on my form for the width of 4 textboxes.

Me!Board_MemberIdFK.Width = 700 ' 1440 twips = 1 inch.
Me.FirstName.Width = 100
Me.AppointedBy.Width = 300
Me.DateAppointed.Width = 900

I don't understand because I think the DateAppointed width should be 9 times
wider than the FirsName width, but they are basically the same. I changed
DateAppointed to 900 just to see but nothing. I'm using this on "form open",
should it be some place else??

Thank You
 
I created a form with the controls you listed and applied the code that you
have. The results is exactly as it should be. One thing that is a little
curious to me is why you would want the first name field to only be a little
more that 1/16" wide. That is what 100 twips is. That is hardly wide enough
to see a complete single character. If you are just testing to see if is
works as designed, then that is great and I can tell you that the widths of
the text boxes will be as you have specified them. For my test, I entered an
"a" in the "FirstName" text box and it does not display that character
completly. I then entered 9 of the same character in the DateAppointed field
and it did display all of the 9 characters.

Can you be a little more specific about what you are wanting to do?
 
Well, I could imagine a MemberID textbox being 1/2 inch (700 twips), but I
would expect a FirstName and AppointedBy to be an inch (1440) or more, not
100 (1/14th of an inch) or 300 (3/14ths inch) twips wide.

To prevent my forgetting to use twips, and to make it easier to read when I
(or someone else) is debugging I have a little function (InchToTwips) that I
call when I want to set control sizes:

Public Function InchToTwips(Inches as double) as Integer

InchToTwips = Inches * 1440

End Function

Then I just use the following in my code

Me.Board_MemberIdFK.Width = InchesToTwips(.5)
me.FirstName.Width = InchesToTwips(1.5)

HTH
Dale
 
Dale,

That is a really good way to deal with setting the width of controls. I had
not thought of doing it that way but it is a very good solution.

Thanks for sharing.

Mr B (askdoctoraccess dot com)
 
Back
Top