Solved Show/Hide Application Window for Database (1 Viewer)

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
Hello,

I've seen @isladogs this post in demo database forum. Thanks a lot for Great database. I've tried to apply it in my database. Everything is fine except one problem that you already had mentioned i.e. Report Printing. My form has three buttons, Print Preview, Print Directly, and Save to PDF. When I click print preview, I don't know what happens and i can't select any form, neither I can see the print preview. Then i have to end task Access from task manager and then reopen Access.

Print preview button is set to open the report in print preview mode, i don't intend to print it from that mode but it's not showing that window. Is there any fix for that?

Best Regards
Abdullah
 

missinglinq

AWF VIP
Local time
Today, 07:31
Joined
Jun 20, 2003
Messages
6,423
If you want us to help you debug your code, for the print preview button...you have to show us the errant code!

We're good...but not clairvoyant...well, except for MajP!

Linq ;0)>
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:31
Joined
May 7, 2009
Messages
19,175
as you know, msa was written in c++ and we dont really know what is happening on the hood or which dll are being called to open the forms, reports, etc. What i mean is that we are not really sure if our eperimentation on hiding totally access interface will work or not. if Collin is part of msa development, then perhaps he can pinpoint which area to work on an fix to make such experimentation work in any situation.
 

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
Hello,

I've seen @isladogs this post in demo database forum. Thanks a lot for Great database. I've tried to apply it in my database. Everything is fine except one problem that you already had mentioned i.e. Report Printing. My form has three buttons, Print Preview, Print Directly, and Save to PDF. When I click print preview, I don't know what happens and i can't select any form, neither I can see the print preview. Then i have to end task Access from task manager and then reopen Access.

Print preview button is set to open the report in print preview mode, i don't intend to print it from that mode but it's not showing that window. Is there any fix for that?

Best Regards
Abdullah

Hi @abdullahkhan
I have no recollection of mentioning a problem with report printing and indeed have no issues with that feature using my example app.
I can print reports from print preview or a button click on a form or a button click on a report in report view.
I also see no reason why print direct or save report to PDF should fail
Perhaps its your implementation of the code that's causing issues for you.
As others have said, you really need to show the exact code that's causing issues.

In case it helps, attached is the latest version (3.46) of my app which, by chance, contains additional ways of displaying reports in this setup
 

Attachments

  • SetWindows - v3.46.zip
    302.2 KB · Views: 236

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:31
Joined
May 7, 2009
Messages
19,175
still buggy so far.
I open the report, it displays as Report View, not Print Preview.
close the report and open the query and suddenly the Main A window showed up without title bar.
 

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
As others have said, you really need to show the exact code that's causing issues.

If you want us to help you debug your code, for the print preview button...you have to show us the errant code!

Dear @isladogs and @missinglinq Thanks a lot for reply. My DB is attached. In more tab, kindly use "By Customer" button and select customer 1 and then click "Show Reports" button. Sorry for late reply because i was away from my PC and using phone to access this forum.
 

Attachments

  • RMS.zip
    176.6 KB · Views: 150

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
@abdullahkhan
I did that and the app hangs. In fact it hangs clicking any of the buttons on that form. I had to use Task Manager to escape.
Will try again on another PC later

@arnelgp
I can't replicate your issue. Apart from you, nobody has reported any bugs in the latest versions of the app.
In fact I don't think you've found a bug

The app has several different ways of opening the report which were added due to user requests.
If you look at the form menu, you will see options to open the report in print preview or report view.
Closing the report doesn't cause the effect you stated in my tests.

I am aware that clicking the open query button does display the application window and navigation pane.
However that item is there for a reason....to show that side effect and to show a better solution which doesn't have that issue
The following menu item shows the same query results using a form
 

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
I did that and the app hangs. In fact it hangs clicking any of the buttons on that form. I had to use Task Manager to escape.
Will try again on another PC later
Yes, once you click the "Show Reports" Button, app hangs. I am not sure if app hangs or modal dialogue of print preview of the report is not letting it to be clicked anywhere else. But I dont know where does that modal dialogue go after clicking "show button".
 

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
@arnelgp
The OP is reporting bugs in his own app not mine.
I'll need to look at his code to determine what the issues are (not until this evening UK time)

The example app has been downloaded several thousand times and thoroughly tested by both myself and many other users.

As stated, I don't believe you found a bug in this version.
However, you've been negative about the app since I first released it around three years ago.

Opening a query will expose the application interface.
As stated previously, that item is there as a warning to use a different approach.

If you really have found a bug, please provide specific details about how to trigger it
 

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
@abdullahkhan
You mentioned using dialog mode.
That is going to prevent other items working correctly in this scenario.

Suggest you open form as popups and close or hide each form when you open another

I've had a quick look at your app and noticed you are using embedded macros.
I never use these and doubt you have sufficient 'power' doing so.
You need to use event procedures as in my application

Have a careful look at the code I use to open the reports in my example app...and get rid of all embedded macros.

Also I NEVER use Access navigation forms. These are well known to cause issues if you try to modify them significantly.
It may be that the navigation form will prevent issues

As a test, I bypassed frmRMS and opened frmByCustomer direct.
I replaced the embedded macro with an event procedure:

Code:
Private Sub cmdOK_Click()
    DoCmd.OpenForm "frmByCustomer", , , , , acHidden
    DoCmd.OpenReport "RptReportsByCustomerA4Portrait", acViewPreview, , , acDialog
End Sub

and changed the report to popup = true.
It worked fine

Capture.PNG


I then tried again opening frmRMS first. This time it failed.
That seems to suggest the navigation form is a problem.

No time to do any more to this now
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:31
Joined
May 7, 2009
Messages
19,175
yes, it's not a bug.
 

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
@abdullahkhan
I've had a quick look at your app and noticed you are using embedded macros.
I never use these and doubt you have sufficient 'power' doing so.
You need to use event procedures as in my application.
Thanks for suggestions. I use embedded macros because I am beginner and don't know much of VBA. And I'll Tremont the navigation form to check and will post results here.
Best Regards
 

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
@arnelgp
Thanks for confirming that

@abdullahkhan
This type of application where you are hiding the application window is not a beginner's project.
You will need to learn VBA to do this successfully.
Embedded macros may be fine for simple projects but they are limited in scope.

Suggest you scrap the navigation form and create your own form using a tab control.
It will look and behave very similar to what you have now but without the issues of the navigation form
 

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
Suggest you scrap the navigation form and create your own form using a tab control.
It will look and behave very similar to what you have now but without the issues of the navigation form
I removed the navigation form, replaced macros with VBA code, and also brought the show Reports option on the same form which has on load event (to check if this problem is not due to the reason that show Reports is on other form because I'm your app, show report in print preview is on the same form). But behavior is same. Can you give another look on the DB where I'm doing wrong? I don't understand why this code is not being implemented in my DB because my db and form seem to have same scenario as your app (which is an incredible app by the way). I copied pasted related code from your db to avoid any mistake. See frmMore form in the DB.
 

Attachments

  • RMS.zip
    285.6 KB · Views: 135

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
Hmm. I spent some time trying to work with your forms then started again with new forms etc
There were problems with your forms frmRMS & frmMore that prevented the code working correctly

Your frmRMS was a strange imitation navigation hybrid form that was more complex than needed

Just to make it clear, the issue was nothing to do with my code.

Main changes made:
1. Added Option Explicit to all code modules. You should ALWAYS have this to ensure all variables are defined
2. Removed all unnecessary items you had copied from my code but aren't using e.g. Autokeys macro, modResizeForm etc
3. Created a new start up form frmStart which uses the tab control I recommended
This currently has 4 tabs to mimic what you had - I ignored frmMore as it is surplus to this issue
4. Added a module modFunctions with 2 functions - used to grab the customer code & name -
This avoids the need to reference forms in your query filter criteria
5. Changed forms & report to popup style so the acDialog mode isn't needed
6. Added code to ensure a customer is chosen before running the report
7. Added a print button to your report so it can be directly printed in report view
If preferred, it could instead be opened in print preview - your choice

As I hope you will see, the forms & report now work as you intended with the application window removed.
Please study the code carefully before attempting to modify it further or add to it

Good luck with the rest of your project

NOTE: Where I've modified any of your items, the original is saved with a BKP suffix.
 

Attachments

  • RMS_v2_CR.zip
    103.3 KB · Views: 239

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
Just to make it clear, the issue was nothing to do with my code.
There is no doubt that they're is no issue with your code and there is problem with my implementation which I wanted to know what it is and sort it out.. Thank you very much for doing so much for me.
 

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
You're welcome. In this case it was quicker to start again with new forms.
If you are happy that it now works, you can delete all objects with a BKP suffix.
Any questions, let me know
 

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
In this case it was quicker to start again with new forms.
If you are happy that it now works, you can delete all objects with a BKP suffix.
Yes, I'll go with the new one. Thanks again.
 

Pac-Man

Active member
Local time
Today, 16:31
Joined
Apr 14, 2020
Messages
408
One other thing, if i set application icon in Current document setting under the Access options, it is not displayed in the taskbar. Is it possible to have the icon along with hiding the application windows?
 

isladogs

MVP / VIP
Local time
Today, 11:31
Joined
Jan 14, 2017
Messages
18,186
One other thing, if i set application icon in Current document setting under the Access options, it is not displayed in the taskbar. Is it possible to have the icon along with hiding the application windows?

This can be done for any Access app whether or not the application window is hidden.
For example, this is my version of your app that I uploaded in post #15

Capture.PNG


However, this only works if you open your app from a shortcut where the target path is:
Path to Access program file followed by path to Access application

e.g. "C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" "D:\Colin\My Documents\My Downloads\RMS (1)\RMS_v2_CR.accdb"
I suggest you use the application icon as the shortcut icon

NOTE: If you open your app by any other method, the taskbar icon will just be the Access program icon

Here's another tip you may find useful
You can prevent the Access splash screen appearing when you open your app from a shortcut by creating a small BMP file with the same name as your app (e.g. RMS_v2_CR.bmp) and saving it in the same folder as your app. The bmp file does NOT need to contain an image

Hope that helps
 

Users who are viewing this thread

Top Bottom