resizing control on form open

  • Thread starter Thread starter DP
  • Start date Start date
D

DP

Could someone tell me how to resize a control like a label or listbox when
the form opens to be the EXACT same height and width of the forms detail
section?

For reasons important to me, but not essential to describe here, I would
like to open this form in hidden view when I start the database, make sure
that the specific control I have in mind is resized to the exact same height
and width of the form's detail section, and then save the form - without the
user ever seeing it.

I don't know why something like this is not working:

Me.ControlX..height = Me.Section(acDetail).height

Controlx is not resized.

I would also like to program the explicit dimensions of this form the first
time it's open. Just for example, so that everything is, say, 1440 twips
width by 2000 twips height.

This would then, I guess, have to apply to ControlX, the forms Detail
section, AND the form itself (?).

Can anyone help?

Thanks!
 
Me.ControlX..height = Me.Section(acDetail).height

Try this:

Me!ControlX.height = Me.Section(acDetail).height


Also, if you want to save the changes to the form, you'll have to open
the form in design mode, make the changes, then save it. This can be
done programatically.

I'll bet there's an easier way to do whatever it is you are trying to
do.

Hope this helps,

Peter De Baets
Peter's Software - MS Access Tools for Developers
http://www.peterssoftware.com
 
Peter, there may be an easier way, but your were the perfect person to
answer because the problems I encounter are related to having resizing code
on this (and other forms). I use a "combination" of the resizing code from
the Access Developers Handbook and your resizing code. By "combination" I
don't mean that I use them together (!). We corresponded about this issue
once before. I use the Developer Handbook resizing code. But - as I told you
once in our correspondence - on occasions, and for reasons I don't
understand, the forms got saved in the LARGE (rezized UP) version. It had to
do somehow with my working with the form's module, which opened the form in
designed view, and somehow it got saved in that large version.

This wrought havoc when the same form was opened on a computer with a
smaller resolution.

I use your code to open the offending forms in design view and resave them
back to smaller sizes.

Sounds convoluted, and it probably is, but I haven't hit on a better
solution.

The problem with the one form I'm inquiring about is caused when an imaging
software control, which just looks like a rectangle on the form, acquires a
different size than the form's section.

They need to be identical, or the form + plus image doesn't display
properly.

This never happens on my working computer. But if I transfer the identical
database file to, say, my laptop, with it's lesser screen resolution, that
form starts to cause problems UNTIL I physically open it up in form detail,
resize the image control to the exact height and width of the Detail
section, and save it.

Then things are fine.

But this is not an issue I can pass along to "end users."

My idea was that if,whenever the database is first started, this offending
form opens in hidden view, in design mode, the image control is made equal
in height and width to the Detail section, then saved and closed, the
problem would be fixed from then on on that particular computer.

I'll try what you suggested, but I think I tried this - it's fairly
obvious - a long time ago, and the form won't save with ControlX having been
made equal in height and width to the Section.

David Pike
 
Peter, I'm making progress (on something so simple), but there is no
property for Me.Section(acDetail).Width, is there!?
 
Back
Top