|
-
Sep 12th, 2005, 05:37 PM
#1
Thread Starter
New Member
In Access, resize size application to size form
Hello,
I'm using Access.
I want to specify the size of the application (Access) to be adapted with the size of a form (which dimensions can't be changed) and i want the form to be anchored on the top left of the application. I thought to put the code in the Form_load.
I found a lot of threads that deal with resizing but all of them seem to answer the problem 'size of the controls' with 'size of the form'.
If someone can help me !
Thanks by advance.
-
Sep 12th, 2005, 10:08 PM
#2
Frenzied Member
Re: In Access, resize size application to size form
Hey le highlander:
I am not exactly sure if I understand what it is you want to do, but it sounds like you want the form to appear in a certain area of the screen when you run your application and also to have all your controls appear in a certain area on the form.
If, for example, you want to application to fill the entire screen you would use the WindowState property. This can be set at design time or at run time. At design time just select WindowState in the properties window and select either 0-normal, 1, minimized, or 2, maximized. You can also do this with code in the form load event as you stated. Just use WindowState = 2 or whichever choice (0 - 2) that you desire.
If you want to make your form appear in a certain area on the screen you can use code in the form load event such as: Me.Move 2700, 3000
The 2700 is the distance from the left side of the screen and the 3000 is the distance from the top of the screen (assuming you set the WindowState property to 2-Maximized). This in in pixels. You can play around with the numbers until you get a feel for it and adjust the numbers according to where you want your form to appear.
If you want to make your controls appear in a certain location on your form, you do much the same thing. To do this you can set the left and top properties for each control in reference to your form. Again this can be done through the properties windows or in your code.
I hope this helped.
Good Luck
-
Sep 12th, 2005, 10:31 PM
#3
Thread Starter
New Member
Re: In Access, resize size application to size form
hello
Thanks for your response.
When i read what you wrote, it seems to be what i want. But it doesn't work when i put it in the form_load (Me.Move ....). Is says 'Compilation Error'.
-
Sep 12th, 2005, 10:37 PM
#4
Re: In Access, resize size application to size form
Don't you want ACESS to line up with a VB form?
-
Sep 12th, 2005, 10:39 PM
#5
Thread Starter
New Member
Re: In Access, resize size application to size form
-
Sep 12th, 2005, 10:56 PM
#6
Re: In Access, resize size application to size form
Moved to Office Development forum.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 12th, 2005, 11:03 PM
#7
Thread Starter
New Member
Re: In Access, resize size application to size form
sorry to have put the thread at the wrong place
-
Sep 12th, 2005, 11:06 PM
#8
Re: In Access, resize size application to size form
Its not a problem. It takes members a while to get a feel for the Forums and where their threads are best suited.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2005, 06:36 AM
#9
Lively Member
Re: In Access, resize size application to size form
Not what you want, but why not just size the form with Access as maximized. It pseudo-hides Access behind the form.
VB Code:
Private Sub Form_Load()
DoCmd.Maximize
End Sub
Or you can make Access hidden while the form is shown. Probably less code required with these two manners, but the latter requires some api.
Also, the MoveSize Command:
VB Code:
Private Sub Form_Load()
Application.DoCmd.MoveSize 100, 5, 5000, 5000
End Sub
-
Sep 13th, 2005, 03:20 PM
#10
Thread Starter
New Member
Re: In Access, resize size application to size form
The MoveSize command was very useful ! Is there a way to size the Access window ?
-
Sep 13th, 2005, 04:09 PM
#11
Re: In Access, resize size application to size form
You would probably have to use some APIs to resize the main app window as it only allows for the 3 window states and doesnt ahve a size window property or method.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2005, 04:17 PM
#12
Re: In Access, resize size application to size form
This should resize the mailn application window to what ever size you need. 
VB Code:
Option Explicit
Option Compare Database
Private Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub ResizeApp()
'Resize main app window to 700 high x 1000 wide
'x and y are the orgin of the top/let corner
'cx and cy are the size of the window.
Application.RunCommand (acCmdAppRestore)
SetWindowPos Application.hWndAccessApp, 0, 0, 0, 700, 1000, 0
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2005, 05:15 PM
#13
Thread Starter
New Member
Re: In Access, resize size application to size form
ohhhhhhh it's beautiful !
thanks a lot.
-
Sep 13th, 2005, 05:17 PM
#14
Re: In Access, resize size application to size form
Finally, someone that appreciates the true beauty of my code! Thanks
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2005, 08:50 PM
#15
Lively Member
Re: In Access, resize size application to size form
Can't say I have ever resized the app window to meet the form window (usually the other way around) very nice code RobDog888.
-
Sep 13th, 2005, 08:53 PM
#16
Re: In Access, resize size application to size form
Thanks Justin. I too usually do it the other way around but have used this code before on VB6 forms for various things. I never thought t would work for this but Access is also just a regular MDI window so I guess its logical.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|