Putting a button at the corner of a form

S

Simon Kravis

I would like to put a button in the lower LH corner of a resizeable
form.Using the code:

Command0.Left = Me.WindowWidth - Command0.Width
Command0.Top = Me.WindowHeight - Command0.Height - 900

in the Form_Resize event of an Access 2000 form, I am able to
increase the form width on resize, but increasing the form height
gives Runtime Error 2100 'The control or subform is too large for this
location'.

Any ideas?

Simon Kravis
 
M

MGFoster

Simon said:
I would like to put a button in the lower LH corner of a resizeable
form.Using the code:

Command0.Left = Me.WindowWidth - Command0.Width
Command0.Top = Me.WindowHeight - Command0.Height - 900

in the Form_Resize event of an Access 2000 form, I am able to
increase the form width on resize, but increasing the form height
gives Runtime Error 2100 'The control or subform is too large for this
location'.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's some code I used to resize a TextBox (the only control on the
form). Perhaps it will work for you, after modification.

Private Sub Form_Resize()
' When the form resizes then the Note control resizes correspondingly.
' Modelled on Access 95 How-To by K.Getz & P. Litwin; p.92.

Dim h As Integer
Dim w As Integer
Static fInHere As Boolean

Const MIN_H = 2000 ' Twips or 1.38"
Const MIN_W = 4000 ' Twips or 2.77"

If fInHere Then Exit Sub
fInHere = True

On Error GoTo err_

' Get current Form size
h = Me.InsideHeight
w = Me.InsideWidth

' Check if w & h are in minimum limits.
If w < MIN_W Then
DoCmd.MoveSize , , MIN_W
w = Me.InsideWidth
End If
If h < MIN_H Then
DoCmd.MoveSize , , , MIN_H
h = Me.InsideHeight
End If

' Set detail section's height to same as form's height.
Me.Section(acDetail).Height = h

' Set the control's height & width to correspond to the form's h &
w.
With Me!Note
.Height = h - (.Left + .Top)
.Width = w - .Left
End With

err_:
fInHere = False
Exit Sub

End Sub

- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQFkaoYechKqOuFEgEQKiQACgzqjrlMJD75kMEqC9voxCNfo0wGoAoNQA
ymSGi1u35eSHOTtRY47RtF4j
=9y1/
-----END PGP SIGNATURE-----

--
 
S

Simon Kravis

Fix was that Me.Detail.Height needs to be changed explicitly in
Form_Resize event:

Command0.Left = Me.WindowWidth - Command0.Width
Me.Detail.Height = Me.WindowHeight
Command0.Top = Me.WindowHeight - Command0.Height - 900 ' add space for
navigation bar height if needed
 

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