Solved

acHidden doesn't fully hide the form

Posted on 2010-11-11
19
1,050 Views
Last Modified: 2012-05-10
Hello Experts,

This is frustrating!

I have a form which opens on startup, and this form opens a form conveniently named "frmHidden" in the background.
frmHidden runs some important "closure" tasks that need to be done when the user closes access.
The database has an extensive menu system that means that they can close the DB when any form is open, which is why I created this "hidden" form.

However. When the form is open, it still appears in the taskbar at the bottom, which I don't want.

If I highlight the form and click Window > Hide it does what I want.

Any suggestions?

Thanks.
0
Comment
Question by:INHOUSERES
  • 8
  • 5
  • 5
  • +1
19 Comments
 
LVL 6

Expert Comment

by:YohanF
Comment Utility
attach the db... because I use that and works like a magic... so there may be another problem...
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
from Access window
tools > options > View tab

uncheck Windows in taskbar
0
 
LVL 5

Author Comment

by:INHOUSERES
Comment Utility
Yohan,

I've just discovered that it only does this when the database is first opened.
I have a main menu, and this opens the form hidden but shows at the bottom. If you click a main menu option then go back to the main menu, frmHidden is actually hidden.

capricorn,

This db is used by many people on many machines and I need this to be part of the DB, not access.

Hope this helps.
0
 
LVL 6

Expert Comment

by:YohanF
Comment Utility
This is what I use "DoCmd.OpenForm "xxxx", , , , , acHidden"

What I do is I open it from the login page and them open up the main menu... give that a try...

although I really dont understand what you mean by shows at the bottom.. ahhahh.. check whether there is another line of code which opens the same thing without acHidden parameter ?

0
 
LVL 5

Author Comment

by:INHOUSERES
Comment Utility
On the main menu (which is opened as part of the applications "Startup", Not an AutoExec macro) I have the below code which opens the form, but it's not hidden.

if I Open one of the menu's options, it will close the main menu and open another menu with more options.
If this menu is then closed, it then opens the main menu again (which in turn would open the frmHidden again). This time, the form is properly hidden - it doesn't show up in the taskbar or on screen.

and by "taskbar", I mean the windows taskbar.
Private Sub Form_Open(Cancel As Integer)
    DoCmd.OpenForm "frmHidden", , , , , acHidden
End Sub

Open in new window

0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
add codes to check if the form "frmHidden' is already open

Private Sub Form_Open(Cancel As Integer)

if isLoaded("frmHidden")  =true then
    'do nothing
    else

    DoCmd.OpenForm "frmHidden", , , , , acHidden
end if
End Sub


place this codes in a regular module





Function IsLoaded(ByVal strFormName As String) As Boolean

 ' Returns True if the specified form is open in Form view or Datasheet view.

    Dim oAccessObject As AccessObject



    Set oAccessObject = CurrentProject.AllForms(strFormName)

    If oAccessObject.IsLoaded Then

        If oAccessObject.CurrentView <> acCurViewDesign Then

            IsLoaded = True

        End If

    End If

    

End Function

Open in new window

0
 
LVL 5

Author Comment

by:INHOUSERES
Comment Utility
Let me try explain this with pictures.

I hope they're in the right order.
1 = this is what you see when you open the DB. Notice "frmHidden" in the taskbar.
2 = This is just a random menu which is shown after clicking one of the buttons on the main menu
3 = Click the button in the bottom left of image 2 would take me back a menu, to the main menu again. Notice frmHidden is now gone.

There is no code at all in the other form which references frmHidden.

Hope this explains further.
not-hidden.PNG
random-menu-item.PNG
closing-other-menu-back-to-main-.PNG
0
 
LVL 5

Author Comment

by:INHOUSERES
Comment Utility
Image one didn't work properly, but frmHidden is there on the taskbar.

I've just created an AutoExec macro which opens both forms. frmHidden is successfully hidden.

Another Bar Stared bug by microsoft?
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility


call this line in the startup of your application

Application.SetOption "ShowWindowsInTaskBar", 0
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Accepted Solution

by:
INHOUSERES earned 0 total points
Comment Utility
Capricorn,

I know that would assist this issue, but we do require items to show in the taskbar when they need to be.
I for one am usually cycling between 2 or 3 tables and queries that are open to gather information which I like being in the taskbar.

acHidden should HIDE a form so it's not visible.
If used in a form that is opened from startup, it doesn't work.
Simple as that.

If you want to open 2 forms on startup. One hidden and one not. Use AutoExec.
After that, go to www.microsoft.com and throw up a middle finger.

I hope this helps someone else in future.
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
<If you want to open 2 forms on startup. One hidden and one not. Use AutoExec.>

well, that is exactly how this should be done.

this is the way to go when you want to prevent closure of the App when the (X) button in the Access window was clicked
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
here is the link, about this trick
http://www.mvps.org/access/general/gen0005.htm
0
 
LVL 5

Author Comment

by:INHOUSERES
Comment Utility
Capricorn,

I'm not sure if you've understood the issue at all.
I don't want to prevent my users from closing access when they want.
It would annoy them and I wouldn't be very popular.

This is why I created the hidden form so that It would perform important cleaning duties whatever the user does.
It would always just be there in the background, and when the form's unload event is triggered, badda bing badda boom!
0
 
LVL 6

Expert Comment

by:YohanF
Comment Utility
Hey

When you open the main menu, do you open it as a Dialog window ???

Just wondering

cheers
Yohan
0
 
LVL 6

Expert Comment

by:YohanF
Comment Utility
I mean in teh first AutoExec..  And if so make it blank or Normal and try..
0
 
LVL 84
Comment Utility
Are you sure the comment you've proposed a solution is an actual answer? It seems more like a response to someone else.
0
 
LVL 5

Author Comment

by:INHOUSERES
Comment Utility
Yohan,

It's not dialog.

LMS.

The first part of the post was a response, but the second part goes onto say that a solution (not necessarily THE solution) was to use an autoexec macro to open both forms, and not to use the initial form to do the work.

The autoexec solves my issue, but doesn't explain why it happens in the first place.
Either way, to my knowledge, running the commands via the macro are no different to actually running it from the form.
I assume the macro just runs it's own little code to open both forms:
docmd.OpenForm "frmMainMenu"
docmd.OpenForm "frmHidden",,,,,achidden

Open in new window


The form triggering the other form was opened on startup, which seems to have caused the issue, because when both forms are open, and frmMainMenu is opened again, the form is officially hidden.

Open to debate I guess! :)
0
 
LVL 6

Expert Comment

by:YohanF
Comment Utility
Can you put a copy of your database (if you are worried about content/functionality just include only those 2 forms).. Its way easy to debug any errors that way rather than just predicting things...
0
 
LVL 5

Author Closing Comment

by:INHOUSERES
Comment Utility
solved it myself
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now