Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / October 2005

Tip: Looking for answers? Try searching our database.

Changing Form properties when Form Inactive

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Harison - 25 Oct 2005 20:40 GMT
Hello!
My database has a Master Menu (not created with a wizard)  There are command
buttons to call other forms & reports.  (I use macros for this)
I am trying to devise a way, using Visual Basic,  to change the properties of a
form when that form does not have the focus.  Specifically- Master Menu is
maximized upon activation, but when  Master Menu transfers focus to another
form, I want that form windowed--not maximized.  Problem is maximized Master
Menu is visible behind the new form, and I would like it minimized.  I used
DoCmd.minimize in the deactivation event, but how do I get it re-maximized when
I close the new form?  There must be a way to change the properties of a
non-active from in a VB routine called by another form. I tried:
Forms![Master Menu].windowstate=vbminimized
Got an error message.  That was all I could think to do.  Please help!

All the Best . . .
Richard Harison
lwells - 25 Oct 2005 22:31 GMT
Richard,

I use the OpenArgs for this purpose in my application.

Try this, from you command button that opens your form add the last argument
to your open form with Me.Form.Name

example:
DoCmd.OpenForm "OtherFormName", , , , , , Me.Form.Name

Then in the Open Event of the form that was opened place this code

If Not IsNull(Me.OpenArgs) Then
DoCmd.SelectObject acForm, Me.OpenArgs
DoCmd.RunCommand acCmdWindowHide
End If

This will hide your Main Menu form

Then in the close event place this code
If Not IsNull(Me.OpenArgs) Then
DoCmd.OpenForm Me.OpenArgs
End If

This will reopen your Main Menu form when you close the form.

> Hello!
> My database has a Master Menu (not created with a wizard)  There are command
[quoted text clipped - 12 lines]
> All the Best . . .
> Richard Harison
Richard Harison - 26 Oct 2005 18:16 GMT
I am a little confused by your reply as to which form is which.  Maybe you could
restate your solution using my real form names.  In my app, when Access opens,
the form [Master Menu] automatically appears maximized.  A command button on
{Master Menu] calls, by macro (NOT VBA), the form [Volunteers], which is
displayed windowed, and [Master Menu] remains in background.
It just seems to me that VBA should be able to focus a form by tracing the
correct path,  i.e. Forms![formname]....
Thanks for your help
Signature

All the Best . . .
Richard Harison

> Richard,
>
[quoted text clipped - 38 lines]
> > All the Best . . .
> > Richard Harison
lwells - 26 Oct 2005 22:03 GMT
Richard,

You have just seen one of the limitations by using a macro.  Why not try to
code using VBA in your events with the example supplied.

On your [Master Menu] using the button that opens the form [Volunteers]
place this code in the On Click event.  You will need to open the VBA editor
to paste this code in.  Click on the elipse the three dots to the right (...)
once you place your cursor in the On Click field.  Select Code Builder and
paste the code between the blue Private Sub and End Sub blocks.  Normally the
cursor will already be there to paste the code below.

DoCmd.OpenForm "Volunteers", , , , , , Me.Form.Name

In the Open Event of your [Volunteers] form paste this code (VBA Editor
window)

If Not IsNull(Me.OpenArgs) Then
DoCmd.SelectObject acForm, Me.OpenArgs
DoCmd.RunCommand acCmdWindowHide
End If

Then in the Close Event of [Volunteers] form paste this code (VBA Editor
window)

If Not IsNull(Me.OpenArgs) Then
DoCmd.OpenForm Me.OpenArgs
End If

This will accomplish what you are after without using a macro.

> I am a little confused by your reply as to which form is which.  Maybe you could
> restate your solution using my real form names.  In my app, when Access opens,
[quoted text clipped - 48 lines]
> > > All the Best . . .
> > > Richard Harison
Richard Harison - 26 Oct 2005 22:43 GMT
LIKE A CHARM!
Many, Many Thanks
(Any thoughts on how to ditch the Database Window as well?)
(Amen! on limits of macros!!)

Signature

All the Best . . .
Richard Harison

> Richard,
>
[quoted text clipped - 79 lines]
> > > > All the Best . . .
> > > > Richard Harison
lwells - 26 Oct 2005 23:28 GMT
Sure,
 Go To Tools/StartUp and uncheck Display Database Window

Cheers

> LIKE A CHARM!
> Many, Many Thanks
[quoted text clipped - 94 lines]
> > > > > All the Best . . .
> > > > > Richard Harison
Richard Harison - 27 Oct 2005 01:02 GMT
Yeah...I knew that...I meant "on the fly" as it were...making it
visible/invisible with the wave of a hand!  Thanks

Signature

All the Best . . .
Richard Harison

> Sure,
>   Go To Tools/StartUp and uncheck Display Database Window
[quoted text clipped - 99 lines]
> > > > > > All the Best . . .
> > > > > > Richard Harison
lwells - 27 Oct 2005 14:35 GMT
Just for fun,

Create a command button on a form and give it the name cmdHide and the
caption of Hide DB.  In the On Click event paste this code:

Private Sub cmdHide_Click()
If Me.cmdHide.Caption = "Hide DB" Then
   DoCmd.SelectObject acTable, , True
   DoCmd.RunCommand acCmdWindowHide
   Me.cmdHide.Caption = "UnHide DB"
ElseIf Me.cmdHide.Caption = "UnHide DB" Then
   DoCmd.SelectObject acTable, , True
   Me.cmdHide.Caption = "Hide DB"
   Me.SetFocus
End If
End Sub

Now you can toggle showing or hiding the database window.  You can probably
adapt the code anywhere you want pretty easily.

Cheers

> Yeah...I knew that...I meant "on the fly" as it were...making it
> visible/invisible with the wave of a hand!  Thanks
[quoted text clipped - 114 lines]
> > > > > > > All the Best . . .
> > > > > > > Richard Harison
Richard Harison - 27 Oct 2005 20:14 GMT
It was fun!  I loved the way you used changing the caption not only to show
which state the button was in but which logic to trigger.  Clever!
My visuals look a lot better now, and since the database is for a social service
organization, it was in a good cause!  Thanks again!!
Signature

All the Best . . .
Richard Harison

> Just for fun,
>
[quoted text clipped - 17 lines]
>
> Cheers
~~~snip
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.