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?
 
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
 
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.