Share via

Anchoring in sub forms

Anonymous
2014-05-22T14:45:37+00:00

Hello.  I have a pretty standard (I think) subform in datasheet format, linking the main table to an intermediate table to a lookup table, and the interface is a combo box allowing users to add one or many related items.  Easy enough.

The only thing I can't figure out is how one ordinarily sets the width of the datasheet.  It should be the one and only thing seen in the subform, with the possible exception of a vertical scroll bar if many items are selected.  I can't seem to get anchoring for that combo box control (or any other control for that matter) to do the trick.

Do people usually size these controls in code?  It would seem like those anchors *should* be able to do the trick much easier.

Thanks.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2014-05-22T23:14:10+00:00

    I've lost count of the number of subforms I must have created over the years which parallel what you are doing, but I must admit that I've never found empty space reserved for a vertical scroll bar to be visually objectionable.  I have never come across an example of anyone resizing a subform control horizontally on the basis of the subform's recordset's RecordCount.

    At the end of the day it all comes down to personal preferences of course, but I have never used a subform in datasheet view.  Invariably in this context I set the DefaultView property to 'continuous forms'.  I also set the DividingLines property to True (Yes), one consequence of which is that the space to the right of the bound control is occupied by these, so is not vertically unbroken when the vertical scroll bar is absent.  Alignment of the subform control's boundaries with controls in the parent form is to my mind also a factor in the aesthetics of the interface.

    You'll find an example as StudentCourses.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.

    This little demo file illustrates several way to represent a many-to-many relationship type in a form, and the example for a conventional subform illustrates the above points.  In the demo the few rows in the subform as it stands means that the vertical scroll bar does not show, but if the subform control is shortened it will show in some cases.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-05-22T18:59:20+00:00

    I generally use the subform wizard to embed an existing form on a main form. I size the control as I think needed and may tweak it later so that only room for a scroll bar is there.

    I rarely control size and position in code. 

    Yeah, that's what I have been doing, but it doesn't "feel" right.  And it doesn't look good, either, that little extra space on the right hand side when the scroll bar isn't there.

    Was this answer helpful?

    0 comments No comments
  3. ScottGem 68,830 Reputation points Volunteer Moderator
    2014-05-22T17:48:34+00:00

    I generally use the subform wizard to embed an existing form on a main form. I size the control as I think needed and may tweak it later so that only room for a scroll bar is there.

    I rarely control size and position in code.

    Was this answer helpful?

    0 comments No comments