Error 2100: The control or subform control is too large for this l

G

Guest

I have an Access 2002 form, which has several buttons a textbox and
listbox. Two of the buttons appear below the textbox when the form is
opened, while the listbox is invisible. If the user presses the browse
button (to the side of the textbox) and selects multiple files to
import, the listbox appears below the textbox with the selected files
and the command buttons move down below the new listbox as the form
expands.


If the user then browses to another location and selects only one file,
the listbox disappears and the command buttons move back up to be just
below the textbox. In both cases, the form size changes to be just tall
enough to show the command buttons. So it can be fairly tall (~5000
pixels) or short (~1500 pixels) depending on the listbox being
displayed or not.


There is no problem here, everything works beautifully.


BUT NOW, the user needs some options, so I am trying to put an option
group below the textbox (between the two command buttons).
Unfortunately (as many of you probably already know) when you move the
frame of an option group (using the TOP property) the entire group does
not move (like it does in design mode!), you have to move each
component of the option group (including labels) and reset the height.


I am getting this error message (2100) when I try to display the
listbox and move the option group below the box at the point I set the
frames top property. I have already moved the command buttons by this
time, so the line of code I use (on which the error occurs) is:
Me.fraStyle.Top = Me.cmdOK.Top


I have done a LOT of debugging around this and find that the forms
InsideHeight is 1545 when controls start moving. The top of the OK
button is 4050 after it moves (even though it's outside the 1545 of the
InsideHeight of the form!). The top of the frame, at this point, is
1020. Why I can't move it to be even with the top of the button at this
point, I don't understand.


All of the components of the frame (pardon me for using "frame" so much
instead of "Option Group", it's the VB programmer in me coming out)
have moved by the time the line of code to move the frames top has
executed and have had no problems. The overall height of the frame now
is 3448, because I had to make it taller (relative to the position of
the OK button) to be able to move the option buttons and such inside
it.


I even tried setting the InsideHeight, before the frame top, so that it
was big enough to hold the height of the frame below the command
button:
Me.InsideHeight = Me.cmdOK.Top + Me.cmdOK.Height + Me.fraStyle.Height +
50


This made the InsideHeight over 8600, but when the line to set the top
of the frame was executed, the error still surfaced.


So basically, this error message is useless!


Can anyone give me something else to try that I may have missed?


Thanks,
Larry
 
M

Michael Cheng [MSFT]

Hi Larry,

Usually this error message means the size of the new control is out of the
main window. I believe we need check the code one by one.

Is it possible for you generate a sample access application, which could
reproduce the scenairo to me? My direct email is
(e-mail address removed) (please remove "online" before you click SEND)


Sincerely yours,

Michael Cheng
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

I have done so much debugging and looking at the sizes and placement of the
control and window, I just can't believe this to be the case.

But I will chop my app down to just this form and email it to you in a
zipped file.
 
J

John Smith

Just a thought, rather than trying to re-size the group to cope with keeping
the controls inside, how about sliding them all down together?

Dim I As Integer
With Forms!Clinician
For I = 102 To 405
!OptGroup.Top = !OptGroup.Top + 10
!Control1.Top = !Control1.Top + 10
!Control2.Top = !Control2.Top + 10
Next I
End With

That runs almost instantaneously for me and you might be able to speed it more
by increasing the size of the steps, if you have enough free space within the
'frame'!

HTH
John
 
G

Guest

Thanks, but the problem is moving the option group does not move the controls
inside the control, it sure would make things a LOT easier if it would work
like that. Then I could move it up or down based where needed!

Thanks anyway.
 
J

John Smith

That is why the loop is moving all of them, just substitute your own names for
OptGroup and the controls (Control1 etc) within it. Sorry if it was not clear.

HTH
John
 
G

Guest

Michael,

I sent you an email back on the 29th with the example attached, and just
sent it again this morning in case you didn't get the other one for some
reason. Please let me know if you are going to be able to help me solve this
one.
 
M

Michael Cheng [MSFT]

Hi Larry,

Thanks for your patience and cooperation.

I have noticed you included radio in a frame and you are moving the radio
inside the frame. You may notice when we are draging the frame in GUI,
every objects inside are moving and if you want to drag something out of
the frame, the frame will automatically expand to the size big enough.
That's why you see the error message 2100. The radio control and lable
control are moving at the same time.

I rewrite the code like below

If (Me.cmdOK.Top + Me.cmdOK.Height) < Me.fraStyle.Top Then
' Move the top of the frame to be the same as the command button.
This will stretch
' the frame to be really tall, which will be fixed when the frame
height is set, after
' each of the components of the frame are moved
Me.fraStyle.Top = Me.cmdOK.Top
Me.lblTransStyle.Top = Me.cmdOK.Top - lngLabelHead
Me.optWithLibrary.Top = Me.cmdOK.Top + lngOpt
Me.lblWithLibrary.Top = Me.cmdOK.Top + lngLabelOpt
Me.optWithoutLibrary.Top = Me.optWithLibrary.Top
Me.lblWithoutLibrary.Top = Me.lblWithLibrary.Top
blnUp = True
Else
Me.fraStyle.Height = 1
blnUp = False
End If

If blnUp Then
Me.fraStyle.Height = 1
Else
Me.fraStyle.Height = 1
Me.fraStyle.Top = Me.cmdOK.Top
Me.lblTransStyle.Top = Me.cmdOK.Top - lngLabelHead
Me.optWithLibrary.Top = Me.cmdOK.Top + lngOpt
Me.lblWithLibrary.Top = Me.cmdOK.Top + lngLabelOpt
Me.optWithoutLibrary.Top = Me.optWithLibrary.Top
Me.lblWithoutLibrary.Top = Me.lblWithLibrary.Top
End If

However, for some reason fraStyle.Top could not be set correctly. I am not
sure why. Anything else included in fraStyle expect lblTransStyle,
optWithLibrary, lblWithLibrary, optWithoutLibrary and lblWithoutLibrary?


Sincerely yours,

Michael Cheng
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Michael,

You have the complete form and can see there is nothing else in the option
group (frame) other than the two labels and two option buttons.

My whole problem has been that the frame doesn't resize it's height for some
reason, the same thing you have now found.

Is this a bug that needs to be reported? It looks simple and
straightforward, so I can't imgaine what is wrong with it, that's why I went
to the message boards for help.

One thing I did discover, if you remove the two labels and option buttons
inside the frame (the label on the frame "lblTransStyle" does not matter) and
comment the code that refers to those controls, the frame resizes properly.
But what good is it to have a frame with nothing in it!?!?!

Surely this is a bug!?
 
M

Michael Cheng [MSFT]

Hi ,

I rewrite the SetControls() as below

Private Sub SetControls()

Dim lngBottom As Long, _
lngOpt As Long, _
lngHeight As Long, _
lngLabelHead As Long, _
lngLabelOpt As Long, _
lngFrameBottom As Long

Dim blnUp As Boolean

' Get the positions of the frame components, based on the current
position of the OK button
lngLabelHead = Me.cmdOK.Top - Me.lblTransStyle.Top
lngOpt = Me.optWithLibrary.Top - Me.cmdOK.Top
lngLabelOpt = Me.lblWithLibrary.Top - Me.cmdOK.Top
lngHeight = Me.fraStyle.Height
lngFrameBottom = (Me.fraStyle.Top + Me.fraStyle.Height) - Me.cmdOK.Top

If Me.lstDocs.Visible Then
lngBottom = Me.lstDocs.Top + Me.lstDocs.Height
Else
lngBottom = Me.txtTransmittalFile.Top + Me.txtTransmittalFile.Height
End If

Me.lblValidate.Move Me.lblValidate.Left, lngBottom + 30
Me.chkValidate.Move Me.chkValidate.Left, lngBottom + 60
Me.cmdOK.Move Me.cmdOK.Left, lngBottom + 405
Me.cmdCancel.Move Me.cmdCancel.Left, Me.cmdOK.Top

Me.fraStyle.Move Me.fraStyle.Left, Me.cmdOK.Top
Me.lblTransStyle.Move Me.lblTransStyle.Left, (Me.cmdOK.Top -
lngLabelHead)
Me.optWithLibrary.Move Me.optWithLibrary.Left, (Me.cmdOK.Top + lngOpt)
Me.lblWithLibrary.Move Me.lblWithLibrary.Left, (Me.cmdOK.Top +
lngLabelOpt)
Me.optWithoutLibrary.Move Me.optWithoutLibrary.Left,
Me.lblWithLibrary.Top
Me.lblWithoutLibrary.Move Me.lblWithoutLibrary.Left,
Me.lblWithLibrary.Top

Me.fraStyle.Move Me.fraStyle.Left, Me.cmdOK.Top
Me.fraStyle.Height = 1


Me.cmdMoveDown.Visible = Me.lstDocs.Visible
Me.cmdMoveUp.Visible = Me.lstDocs.Visible
Me.cmdDelete.Visible = Me.lstDocs.Visible

Me.InsideHeight = Me.fraStyle.Top + Me.fraStyle.Height + 50

End Sub

You may noticed that I set Me.fraStyle.Move Me.fraStyle.Left, Me.cmdOK.Top
twice

1. When we want to move fraStyle up we should first move the fraStyle up
and then move internal controls up. After all of this, I reset the height
to be 1, which will make the height to be a normal one

2. When we want to move fraStyle down, we should move all the internal
controls down and then resert the fraStyle down.


Sincerely yours,

Michael Cheng
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks for trying Michael, but it still doesn't work.

I replaced my SetControls subroutine with yours and it locks up with the
same error on the line: Me.fraStyle.Move Me.fraStyle.Left, Me.cmdOK.Top

Since I was already doing everything you said to do in the order you were
saying, I'm just going to write this off as a bug in Access that can't be
fixed.

I will come up with a work around.
 
M

Michael Cheng [MSFT]

Hi Larry,

I have sent my modified version in a zipped file to you. Hope it helps.


Sincerely yours,

Michael Cheng
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top