Can't adjust field width in combo box

hilian

Episodic User
Local time
Today, 06:09
Joined
May 17, 2012
Messages
130
I have a set of combo boxes that display on subforms in data sheet view. Right now I have four, but I need to add more. One of the combo boxes shows the field for data entry correctly, that is with the correct width. The others are too narrow, and nothing I do to adjust the width changes the way the field displays. I set the column width to 2” and the list width to 3”. The list width displays correctly, but the column width remains about 1”, no matter what I do. If I change it in data sheet view, it will stay as long as I remain in that view, but if I close and open the form, the field returns to the original (too narrow) width.

There’s evidently something that’s controlling the width, but what?

Anybody know?

Thanks,

Henry
 
MarkK,

For some reason, after my struggling with the problem for far too long, Access, all on it's own, decided to give me the correct field width. I must have done something different, but I can't determine what. I've compared the field that originally had the correct width with the fields that didn't but now do, and I can't find any difference.

Anyway, thanks for the code.

If I run into the same problem, which I suspect I will, as I continue to build a large, complex data-entry form I'll know what to do.

Again, thanks,

Henry
 
MarkL,

Access changed its mind and went back to making the field too narrow.

I used your code, and it worked beautifully.

What is 1440 * 2? If I need to make the field wider, what number do I use?

thanks,

Henry
 
The unit of measure in Access is called twips, and there are 1440 / inch, so to make something 1 inch long, you set it to 1440. So if I wanted a control to be 2.75 inches long, I would do...
Code:
Me.tbMyTextBox.Width = 2.75 * 1440
[COLOR="Green"]'not[/COLOR]
Me.tbMyTextBox.Width = 3960 [COLOR="Green"]'it's not clear this is 2.75 inches[/COLOR]
Cheers,
 

Users who are viewing this thread

Back
Top Bottom