Display Form - Hide Database - not working

G

Guest

G'day all

I want to hide everything except a form on a desktop. So I've been to
http://www.mvps.org/access/api/api0019.htm and had a look at the code.

The trouble is that it's not working and I was wondering if someone could
please tell me what I am doing wrong.

WHAT I'M DOING
1) Selecting form that I want to show when the program starts up
2) Selecting "Design Form"
3) Opening "Properties" for the form
4) Going to "Other" and ensuring that "Pop-Up" is set to "Yes"
5) Going to "Event", "On Open", selecting "[Event Procedure]" and pressing
"..."
6) Cut and paste the code from the above link
7) Saving changes

WHAT'S HAPPENING
1) On pasting, the code the 4 lines of "Global Const - -" go red
2) The "End Sub" changes to "End Function"
3) When I click on the form, the following error comes up;-
"The expression On Open you entered as the event property setting produced
the following error: Only comments may appear after End Sub, End Function, or
End Property.
* The expression may not result in the name of a macro, the name of a
user-function, or [Event Procedure].
* There may have been an error evaluating the function, event or macro."

Thanks
 
J

Jeff Conrad

Hi Logi,

Comments below.....
G'day all

G'day to you as well.
Although it is G'evening here.
:)
I want to hide everything except a form on a desktop. So I've been to
http://www.mvps.org/access/api/api0019.htm and had a look at the code.

The trouble is that it's not working and I was wondering if someone could
please tell me what I am doing wrong.

WHAT I'M DOING
1) Selecting form that I want to show when the program starts up
2) Selecting "Design Form"
3) Opening "Properties" for the form
4) Going to "Other" and ensuring that "Pop-Up" is set to "Yes"
5) Going to "Event", "On Open", selecting "[Event Procedure]" and pressing
"..."
6) Cut and paste the code from the above link
7) Saving changes

WHAT'S HAPPENING
1) On pasting, the code the 4 lines of "Global Const - -" go red
2) The "End Sub" changes to "End Function"
3) When I click on the form, the following error comes up;-
"The expression On Open you entered as the event property setting produced
the following error: Only comments may appear after End Sub, End Function, or
End Property.
* The expression may not result in the name of a macro, the name of a
user-function, or [Event Procedure].
* There may have been an error evaluating the function, event or macro."

Here is a past post of mine with instructions on how to set this up.
Hopefully these will help:1. Create a back-up copy of your database file. Don't skip t­his step!!
2. Go to this web site:

http://www.mvps.org/access/api/api0019.htm

Copy all that code to a new standard module.
Module, not form module!

3. Compile the code, save the module and name it modHideAcce­ssWindow.
4. Open your main form (the one that you want the users to s­ee) and go to Design View.
5. Set these Form's Properties:

Auto Center- Yes
Pop-Up - Yes
Modal - Yes

6. Open the code behind the form and copy this code into the­ Form's Open event:

Private Sub Form_Open(Cancel As Integer)

Me.Visible = True
fSetAccessWindow (SW_HIDE)

End Sub

7. You MUST put an exit command button on this form that clo­ses all of Access. Something with a
line
like:

DoCmd.Quit

...in the button's Click event.

8. Compile the code, close and save the form.
9. Close the database and then re-open. It *should* now comp­letely hide the Access window and only
show the data entry form.
Let me know if you have problems.
 
G

Guest

G'day Jeff

One of the strange thing about us Australians is that even at night we still
say "G'day" :)
(G'day [Pronounced Gid-day] is short for Good Day - as in "good day to you")

Thanks sssoooooo much mate. It works brilliantly.

Logi
 
J

Jeff Conrad

G'day Jeff

One of the strange thing about us Australians is that even at night we still
say "G'day" :)
(G'day [Pronounced Gid-day] is short for Good Day - as in "good day to you")

Nothing strange about wishing someone a good day Logi!
G'day to you too!
Thanks sssoooooo much mate. It works brilliantly.

You're weeeeeelcome, glad to help.
;-)
 
G

Guest

G'day Jeff

I spoke too soon.

While the form which shows up on the desktop works according to plan, there
are other problems.

I have a button on the form which links to another form. I got this one to
show up by changing the Pop-Up and Modal to 'yes'. This second form allows
for the user to enter two dates and a choice to either a detail or summary
report. There are two buttons on the bottom of this form which the user
presses to either view or print the report.

I've changed the Pop-Up and Modal properties of the reports to "yes"

The problem I'm having is that once the user enters the date and chooses
either 'details' or 'summary', then presses either "View" or "Print" - the
program freezes (but not the system). I can't do anything except go into Task
Manager to close the program.

Any ideas?

Logi
 
J

Jeff Conrad

G'day Logi,

Well I don't think I can do any better than Albert's reply already.
This particular piece of code, however "cool" it looks by hiding
the Access window, is not really practical for most applications.
As you have only begun to see, problems start to occur when you
need to open different forms and reports. I have only found ONE
particular occasion where this code was well suited. Hiding the
Access window in my opinion is only practical when you need
the users to interface with one, and ONLY one form. No other
forms or reports. Period. With forms you can open one and close
the other, but with reports it is a whole different ballgame. Trying
to manage the code and interface behind this becomes an absolute
nightmare!! In addition, if for any reason Access encounters a
problem it could be left "hanging" and since there is nothing in
the Task Bar, you will have to end the process. This will, not
*may*, lead to eventual data corruption.

I completely agree with Albert that the best thing to do is to
make the application look like a customized application by
creating custom menu bars and tool bars and changing some
of the options under Tools | Startup.
 
A

Albert D. Kallal

G'day Jeff

I spoke too soon.

While the form which shows up on the desktop works according to plan,
there
are other problems.

Yes, note the following text and warning on the link for the code you are
using:

Warning: If you're hiding the main Access window, make sure your error
handlers are good. Because with the window hidden, if an error is raised,
pressing "End" on the Error window will NOT make Access window visible and
you will be left with just the form open. A recommended method is to make
a call to fSetAccessWindow with SW_SHOWNORMAL from your error handlers.
If, for some reason, the Access window does not show itself, then you
can always close the mdb from the Task List, available in Win 95 with
Control-Alt-Delete (once) and under NT, by right clicking on the Taskbar and
selecting Task Manager, by selecting the mdb and clicking End Task.

So, basically, if anything goes wrong, and you don't have very robust error
handing code, you might want to re-consider hiding the main window.

Further, why go through such hoops to hide the main window? Why don't you
keep the main window open, and use it to your advantage?

Word has a large main grey background window, and all documents have to be
in-side of this window. Excel has a large main gray background window,a and
all documents have to be inside this window. So, the menu bars, and tool
bars that you create go at the top. Fact is,the two most popular programs
in the world (Word + Excel) both have this kind of user interface. It is not
like you are going to shock your users. And, after all, ms-access is part of
office, and thus again works the same.

You can keep all users out of the internal of ms-access, and you can hide
all of the-access interface (toolbars etc) without using ANY code, or
security.

I don't think you should be fighting the most widely used interface in the
world, and as you find out..it can be a source of real problems.

So, if you want to see a quick sample of a application that hides all of the
ms-access interface (but still keeps the main window + gray background), try
downloading and running the 3rd example here:

http://www.attcanada.net/~kallal.msn/msaccess/DownLoad.htm

All I used in the above was the tools->start up options, and that can hide
all of the ms-access interface stuff you need. So, don't necessary confuse
the issue of hiding the main gray background window with your need to hide
all of ms-access stuff!!

Further, to get an idea of making user friendly software, the key here it
make your application look, and run just like all the other programs in
office. So, read the following, and take a good look at the screens, and
custom menus used here: (in these shots, all of ms-access is again hidden,
but I do keep the same setup and interface that Word, Excel, and ms-access
normally have....but I hide all of the ms-access features. These screen
shots are towards the end of this article).

http://www.members.shaw.ca/AlbertKallal/Articles/UseAbility/UserFriendly.htm
 
G

Guest

G'day Albert

Thanks for your reply and help.

I created a kind of time sheet where people would just need to press a
button that related to particular company (within our group) while they were
doing work for that company. The reason I wanted to hide the main window was
for security, so they couldn't change the records in the table.

I was able to get all working except for the final print out of a report.

Eventually I followed your suggestion as well as password protected the
programme as it was the easiest option. Like the ad says - "the simple things
in life are often the best".

Thanks again for your help.

Logi
 
G

Guest

G'day Jeff

See my reply to Albert for what I eventually did.

I do appreciate the help.

Logi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top