Set the size of the form in Access 2007 using VBA

ria.arora

Registered User.
Local time
Tomorrow, 07:04
Joined
Jan 25, 2012
Messages
109
Dear All,

I'm trying to set the size of the form in Access 2007 using VBA using below code but this is not working. This was working in Access 2003.

On Form_Load() I'm calling method PositionForm

Code:
DoCmd.MoveSize 100, 100, 600, 600

This is not working not sure why.

I have set Auto Resize to "No", Auto Center to "No". I have set the border style to "Sizeable".

Would anyone have an idea of what I am missing? Is there some option that needs to be set?

Thanks a lot for your help in advance!
 
What is the problem you are getting?

Actually I tried your code and when I increased the size more then 100 and 600, its working fine. With 100 and 600 its not working.
 
I assume there is a Tools|Reference to the DAO library?
 
Form is displayed on full screen. It's not taking the size I have defined. Please find below the code

Code:
Private Sub Form_Load()
    On Error GoTo ErrHandler
    gsCurrentFormName = Me.name
    DoCmd.Hourglass (False)
    varStatus = SysCmd(acSysCmdClearStatus)
    lblStatus.Caption = ""
    'Call CheckUserAccessDetails(gsUserCode)
'    Call PositionForm
    DoCmd.MoveSize 300, 300, 800, 800
    Call DefaultParameters(gsCurrentFormName)
    If IsNull(Me!txtReportingMonth) Or IsNull(Me!txtReportingWeek) Then
        MsgBox "Please Logout and Login again!", 16, "Dashboard Generation"
        Exit Sub
    Else
        Call refreshGlobalVariablesOnLoad(txtReportingMonth.Value, txtReportingWeek.Value)
    End If
ExitHandler:
    varStatus = SysCmd(acSysCmdClearStatus)
    DoCmd.SetWarnings True
    DoCmd.Hourglass (False)
    Exit Sub
ErrHandler:
    MsgBox "Error detected, error # " & Err.Number & ", " & Err.Description, vbOKOnly, "Error"
    lblStatus.Caption = Err.Description
    DoCmd.SetWarnings True
    DoCmd.Hourglass (False)
    varStatus = SysCmd(acSysCmdClearStatus)
    Resume ExitHandler
End Sub
 
You can go to Microsoft office button-access options-current database-choose over lapping windows instead of tabbed documents than restart your project.

Hope this will help.
 
Hi Aleni,

This works. I'm wondering why it's not working when I use Tabbed documents.

Thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom