Code repository - Hide the access prog window (1 Viewer)

PaulJR

Registered User.
Local time
Today, 04:09
Joined
Jun 16, 2008
Messages
133
I wondered if anyone could help me out with this:

I am trying to implement the code provided by ajettrumpet here:

http://www.access-programmers.co.uk/forums/showthread.php?t=171396

My issue is with step 5, I have placed the different code into 'On Open' and 'On Close', but when I run the database and try to open my reports I get the following error message:

Microsoft Office Access can't find the macro 'DoCmd'.

I'm not sure why this is, as I have inserted the macros with the correct function line and I have used all the recommended names, all copied and pasted. Otherwise the database has hidden the program window as it should. Any ideas anyone?

Much appreciated.

Paul
 

ajetrumpet

Banned
Local time
Yesterday, 22:09
Joined
Jun 22, 2007
Messages
5,638
it's probably a piece of code or a snippet that's gotten in the wrong place somehow. either that or corruption has set in.

wouldn't be able to really tell you for sure without seeing the whole code you used.
 

boblarson

Smeghead
Local time
Yesterday, 20:09
Joined
Jan 12, 2001
Messages
32,059
Microsoft Office Access can't find the macro 'DoCmd'.

I'm not sure why this is, as I have inserted the macros with the correct function line and I have used all the recommended names, all copied and pasted.
That error typically happens when you try to put CODE into the event property and not in the VBA window where it needs to go. So, make sure your code is in the VBA window and not in the property line of the properties dialog.
 

HiTechCoach

Well-known member
Local time
Yesterday, 22:09
Joined
Mar 6, 2006
Messages
4,357
Paul,

What version of Access are you using?
 

PaulJR

Registered User.
Local time
Today, 04:09
Joined
Jun 16, 2008
Messages
133
ahh yes, thanks guys - I followed the instructions too explicitly and put the code in the event property at step 5!

Looks like I'll have to open the Access Window to display queries though, and I have lots of them. I think I have a lot of work to do before I can implement this code!!!

Version is Access 2003 SP3.
 

HiTechCoach

Well-known member
Local time
Yesterday, 22:09
Joined
Mar 6, 2006
Messages
4,357
ahh yes, thanks guys - I followed the instructions too explicitly and put the code in the event property at step 5!

Looks like I'll have to open the Access Window to display queries though, and I have lots of them. I think I have a lot of work to do before I can implement this code!!!

Version is Access 2003 SP3.

So you know what you are getting into if you do use this code:

There are many issues when you hide the Access shell, like corrupted data. If you only have data a few entry forms, do NOT want to preview reports to the screen, make lots of good backups of the data so you can recover lost data, then you can use this code successfully.

I normally will not support to any database that has this code running. I have found it not worth the all the extra support issues that casee unhappy users and make me look bad.

Here are some more specifics from an Access MVP and Access Expert found in this Thread (Click Here)

Quite simply, I don't like it, but let me explain.

Point #1: As John already pointed, you better have rock solid error handling procedures throughout your application. This is a good idea in any app, but here it is absolutely vital. An Access app that has to have a manual End Task is at far greater risk of database corruption.

Point #2: Try this - Open your app so the form is showing. Now in most user's Quick Launch Toolbar there is an option called "Show Desktop." Click that button and watch what happens......I'll wait, go ahead and try it......Do you think it is possible your users might do that? Not worth the risk in my opinion.

Point #3: Good luck trying to print preview any reports using this technique! Since all your forms have to be Popup, the reports will have a little bit of an *issue* with this.

Point #4: Simply having all forms Popup and Modal set to True can be somewhat of a challenge making sure everything functions properly.

Most of the time when I see people wanting to use this technique (myself included in years past) they list one of two reasons (or both):
1. They do not want their app to look like an Access application (or make it not obvious it was created using Access).
2. They do not want users choosing options they should not be.

Both of these issues can be solved by using better techniques. The best option is to create custom menu bars and toolbars to hide the main Access ones. You simply present to the users the options *you* want them to see. If you don't want them to press the Delete Record button on the toolbar, then don't show them one! Creating custom menu bars and toolbars can actually be quite fun. In addition, it puts a nice polish on your application and makes it look very professional. Instead of your database looking like an Access file, it will now look like a Windows *application*. Utilize the Tools | Startup options to further customize things so users see what you want them to see.

For information on creating custom menu bars and toolbars, see this area of my Resources page:

http://home.bendbroadband.com/conradsystems/accessjunkie/resources.html#MenuBars

On the flip side, I have seen cases where something like this code can come in handy. The general rules of thumb I like to give out is that:
A. The application has only a few data entry forms to deal with.
B. This is not a mission critical app in case database corruption occurs from a "hang."
C. You do not need to view ANY reports on screen.

Here are two examples for you:
1. I use this for creating a customized login screen to a secured database file. The unsecured file is virtually a throw away file so if something bad happens to it, I don't lose any data. You can read my article and download a sample file here:

http://www.access.qbuilt.com/html/custom_login.html

2. Using the database for like a kiosk situation (like in a mall) where the user will simply be interacting with one or a couple of forms. Possibly even with a touch screen interface.

Hope that helps,
--
Jeff Conrad
Access Junkie - MVP

Hope this helps ...
 

Users who are viewing this thread

Top Bottom