views:

115

answers:

1

I have a simple form in Access 2003. The form has a List control and a button. I wanted to make the list to resize with the form (only vertically) while the button remains at the bottom right of the List. I'm using the following code on the form's resize event.

list.Height = Me.InsideHeight - list.Top - 200
commandButton.Top = list.Height + list.Top + 50

This works fine as I resize the form, until the form height gets to a certain height. Then I get this error;

Run-time error '2100': The control or subform control is too large for this location

This error is occurring at the line where I'm assigning the commandButton.Top. If I remove this line then the list height changes fine. I don't have any subforms in the form.

Does anyone know why this is happening?

Thanks

+1  A: 

I think it is because you need to resize the detail section of the form first.

Try changing the code to

Me.Section(0).Height = Me.InsideHeight 
list.Height = Me.InsideHeight - list.Top - 200 
commandButton.Top = list.Height + list.Top + 50
Croberts
Are you some sort of Access genius or something? Thanks for that, works great now.
Sivakanesh
Not a genius but Access 2003 has been my day job for the past 5 years. Glad it is working for you now.
Croberts
Not meaning to say anything about @Croberts level of knowledge, but why would you (@Sivakanesh) think you could resize the contents of a form control without making sure that the form section itself was large enough to contain the enlarged control?
David-W-Fenton
It is possible in .net. The controls just don't shows because they don't fit, but are still there.
David Brunelle