MS Access - Find width of anchored control?

Using a control in MS Access 2016 that is anchored (the properties for Horizontal Anchor and Vertical Anchor are set to "Both").

But when you try to take the .Width property of the control, it only returns the width (in twips) of the control at the time it was drawn. If the size of the control changes due to the anchoring, the .Width property does not change. It's stuck at the original value.

How to obtain the width/height of a control that has been dynamically resized using anchoring?
milhouse537Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John TsioumprisSoftware & Systems EngineerCommented:
I think its not exposed...probably its an effect that gets applied to the control....but essentially the control remains the same.
0
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
I do not think it is possible. It would however be really nice to have it. You can go to suggest it at the Access Uservoice.

But in the mean time, what are you trying to achieve? Maybe we can come up with a different approach?
0
Gustav BrockCIOCommented:
If the control resizes at once when you change the width of the form, you can record the width of form at launch and subtract that from the current width of the form, and add the result to the width of the control to obtain the current width of the control.

/gustav
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

milhouse537Author Commented:
@Gustav: Interesting idea, I'll have to experiment with that.

@Anders: trying to display a Google or Bing static map in an Access 2016 web browser control on a form. Original thought was to: draw form, wait for resize, find new size of control, convert twips to pixels, send request to Google/Bing with correct pixel size, display map properly filling control. Doesn't work that way. If you maximize the form, the .Width property of the web browser control doesn't change, and the resulting static map image is always too small and doesn't resize with the control. Alternative suggestions welcomed.
0
milhouse537Author Commented:
@Gustav: OK, apparently I'm missing something. If I take the .Width property of the form, or the .InsideWidth property, they always show as the same value from the time the form was opened. Even if I resize or maximize the form. What am I missing?
0
Gustav BrockCIOCommented:
I don't know. I checked, and Me.InsideWidth changes at once when resizing the form.

/gustav
0
milhouse537Author Commented:
Well you're quite right. I was using Me.Form.InsideWidth, which apparently isn't the same. The correct syntax would be Me.InsideWidth. Thanks, it works!
0
Gustav BrockCIOCommented:
Great! And I learnt something new today.

/gustav
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.