Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 506
  • Last Modified:

Minimise form using compiled file

I am totally lost trying to understand why the following code works perfectly in an MDB file but not at all in an MDE file. The code is intended to minimize the popup. Originally I tried to build it into the load event of the form and later the timer event of the form but it won't work in either when the mdb is launched by another mdb so I decided to put a button on the popup that says minimize. I put the following declaration at the top of the form module:
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

I then put the following code in the button On Click event:
    Dim Minimise As Long
    Minimise = ShowWindow(hWndAccessApp, 2)

If I launch the mdb the popup opens. When I press the button the form minimizes. When I turn the mdb into an mde and launch it, the button does nothing.

Any suggestions?
0
Rob4077
Asked:
Rob4077
  • 4
  • 2
  • 2
2 Solutions
 
peter57rCommented:
Are you using the same environment for your mde as your mdb - same folder ?  same Access executable ?   same o/s?

Which Access version and which o/s please.
0
 
Rob4077Author Commented:
Hi Peter (if the 57 is your birth year then its the same as mine)

Yes, I am putting the MDE in the same folder as the MDB. It is using a BE and the way I've created it, an MDB will link to an MDB BE and an MDE will link to an MDE BE but the BE is in a sub-folder. In the opening code I re-link to the BE after compressing the BE.

I am using Access 2007 on a Windows 7 (Home Premium) laptop.
0
 
peter57rCommented:
I don't use A2007 but I can't replicate this problem in A2010.  It works fine for me with both mdb and mde files.  Perhaps wait until someone with A2007 can try it out.

Just in passing, there is no obvious point in converting the backend to an mde as it has no effect on tables.

My 57 means something else.  I'm a bit older than you.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Rob4077Author Commented:
Thanks for checking it out for me. I will wait as you suggest.

The reason I use an mde for the BE is because I don't want users modifying my file.  I use a form that opens when the mde opens on a 5 second timer to tell them it's closing and then it closes. I know they can still link in and use the likes of ALTER TABLE statements to change the tables but it's harder.
0
 
Jeffrey CoachmanCommented:
1. First, I will ask why the standard Minimize button on the form does not work for you...?
If you set the Pop-up property to yes, the Min/max/restore buttons are still visible and working...

2. I don't have the code for the "ShowWindow" function, so I could not test this with Access 2007.

3. My other question would be... Why are you trying to minimize a Pop-up form?
You make a form "PopUp" so that it is the only window that has the focus.
Hence, I don't see a reason for it to ever be "Minimized"

So from where I stand, ...either turn off the "PopUp" property, and let this act as a normal form (that can be minimized using the standard Min/max/restore buttons)

...or leave the form as a Pop-up, and simply "close" it, ...as opposed to trying to "minimize" it.

(Again, the ability to minimize a form defeats the purpose of making it a pop-up form.)

JeffCoachman
0
 
Rob4077Author Commented:
Hi Jeff,

Thanks for your comments.  In answer to your questions:
<<1. First, I will ask why the standard Minimize button on the form does not work for you...? If you set the Pop-up property to yes, the Min/max/restore buttons are still visible and working...>>

I have set the Border Style to Dialog; Record Selectors to No; Navigation Buttons to No; Scroll Bars to Neither; Control Box to Yes; Close Button to Yes; Min Max Buttons to Min Enabled; and Popup to Yes. When I run the code the minimize button does not appear. If I change it to Popup = No, the Minimise button still does not appear.

<<2. I don't have the code for the "ShowWindow" function, so I could not test this with Access 2007.>>

All that is needed to make it work is: put the following declaration at the top of the form module:
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Then put the following code in the button On Click event:
    Dim Minimise As Long
    Minimise = ShowWindow(hWndAccessApp, 2)

<<3. My other question would be... Why are you trying to minimize a Pop-up form?
You make a form "PopUp" so that it is the only window that has the focus. Hence, I don't see a reason for it to ever be "Minimized">>

The solution I have been asked to provide has two tasks. The first task is to give the user the ability to view parsed records. The second is to read emails at a fairly frequent rate, determine if any new emails have arrived that meet specific criteria and if they do, parse the data and drop the details into a database. I originally hoped to include both tasks into a single app but it takes too long to read emails in a timer event and that interferes with the user's ability to view details so I had to slit it into a two applications.

When launched the first app launches the second app. When the second app is launched a small popup appears that shows the app title, the time the emails were last read and, if it is reading, a message that says "Reading Emails...". I want the user to be able to minimise that small window to the task bar but I also want the user to be able to select that second app at any time to see the small status window.

I'm beginning to think that perhaps I should turn the second app into a VB Script that reads emails and loads data into the database. I can then enter a heartbeat indicator into the database and leave the VB Script hidden. I can then modify the first app to display the heartbeat indicator in its main window. What do you think?
0
 
Jeffrey CoachmanCommented:
This works fine for me.

Oh and BTW, you code seems to minimize the entire Access application, not just the form...
Database58.mdb
0
 
Rob4077Author Commented:
I have left this running way too long. sorry. Thanks for your support. I will share the points.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now