A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form Size



 
 
Thread Tools Display Modes
  #1  
Old February 12th, 2009, 07:24 PM posted to microsoft.public.access.forms
CGo
external usenet poster
 
Posts: 7
Default Form Size

I'm still new to 2007 and I can't figure out how to size a form other than
fit to window. I'm sure it's something simple that I'm overlooking but any
help would be greatly appreciated.
  #2  
Old February 12th, 2009, 08:32 PM posted to microsoft.public.access.forms
Dale Fye
external usenet poster
 
Posts: 2,651
Default Form Size

I have a function I use for this purpose. I got tired of trying to figure
out the size of the form, so this way, I just define the size of the form in
the forms Open event. If you put the three functions below into a code
module, you can call them from any form during it's open event.

Private Sub Form_Open

SizeForm 4, 4

End sub

The subroutine accepts the forms dimensions in inches, and then checks to
make sure that the form dimensions don't exceed certain values. For me and
my users, 9 x 12 is about the max they can view on their monitors. This
function calls two other functions fnTwips(), which simply converts inches to
twips by multiplying by 1440, and fnMin( ), which returns the minimum value
from an array of values being passed to it.

Public Sub SizeForm(HeightInInches As Single, _
WidthInInches As Single, _
Optional frm as Form)

If HeightInInches 9 Then
MsgBox "Height (" & HeightInInches & ") exceeds 9 inches!"
End If
If WidthInInches 12 Then
MsgBox "Width (" & WidthInInches & ") exceeds 12 inches!"
End If

'if the frm object was not passed, assume it is the last form opened
if frm is nothing then Set frm = Forms(Forms.Count() - 1)

frm.InsideHeight = fnTwips(fnMin(HeightInInches, 9))
frm.InsideWidth = fnTwips(fnMin(WidthInInches, 12))

'If the form has somehow been maximized or minimized, this will
'restore it to it's defined size
DoCmd.Restore

End Sub

Public Function fnTwips(Inches As Double) As Integer

fnTwips = Inches * 1440

End Function

Public Function fnMin(ParamArray SomeValues() As Variant) As Variant

Dim intLoop As Integer
Dim myMin As Variant

myMin = Null
For intLoop = LBound(SomeValues()) To UBound(SomeValues())

If IsNull(myMin) And Not IsNull(SomeValues(intLoop)) Then
myMin = SomeValues(intLoop)
ElseIf myMin SomeValues(intLoop) Then
myMin = SomeValues(intLoop)
End If

Next

fnMin = myMin

End Function


--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



"CGo" wrote:

I'm still new to 2007 and I can't figure out how to size a form other than
fit to window. I'm sure it's something simple that I'm overlooking but any
help would be greatly appreciated.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.