is there is something wrong in my steps?

H

HANA

i'm useing Access 2002 & wanted my database to display only the form window
when users open it,
without showing the user the Microsoft Access window in the background and
here what i did:
1-I Copied the code from the web site and paste it in a new module. Saved the
module & named it "basSetAccessWindow".

2-Create a form.

3- Set its PopUp property to Yes, Set its Modal property to Yes.

4-in the form's module i did this:

'----- start of form module code -----
Option Compare Database
Option Explicit

Private Sub Form_Close()
fSetAccessWindow SW_SHOWNORMAL
End Sub

Private Sub Form_Open(Cancel As Integer)
Me.Visible = True
DoEvents

End Sub

my problem is that when i finsh my work there is alwayes problem in this
code
"fSetAccessWindow SW_HIDE"

i want to know wher is the wrong in my steps , i will appreicated any help
 
U

UpRider

Hana, I think you can do what you describe without any code. Take a look at
TOOLS | STARTUP.... menu. You can choose here what form to display when the
database starts and not to display the Access window.
UpRider
 
H

HANA

HI
thank you but you miss understand me i want to display my form without the
Access main window the Gray one
if you can help me
i'll be thankful to you
 
H

HANA

hi Up Rider
i get it from Dev Ashish web site & here is copy from the pag:
: Manipulate Access Window
Author(s)
Dev Ashish


(Q) How do I maximize or minimize the main Access Window from code?

(A) Pass one of the declared constants to the function fSetAccessWindow.

This same function can also be used to completely hide Access window and
just show your form on the desktop. Make the form popup and from it's Open
Event, call the fSetAccessWindow function with SW_HIDE as the argument.

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.

'************ Code Start **********
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3


Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
Else
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
End If
fSetAccessWindow = (loX <> 0)
End Function

'************ Code End **********





© 1998-2006, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for
Microsoft Internet Explorer
 
D

Dirk Goldgar

HANA said:
i'm useing Access 2002 & wanted my database to display only the form
window when users open it,
without showing the user the Microsoft Access window in the
background and here what i did:
1-I Copied the code from the web site and paste it in a new module.
Saved the module & named it "basSetAccessWindow".

2-Create a form.

3- Set its PopUp property to Yes, Set its Modal property to Yes.

4-in the form's module i did this:

'----- start of form module code -----
Option Compare Database
Option Explicit

Private Sub Form_Close()
fSetAccessWindow SW_SHOWNORMAL
End Sub

Private Sub Form_Open(Cancel As Integer)
Me.Visible = True
DoEvents

End Sub

my problem is that when i finsh my work there is alwayes problem in
this code
"fSetAccessWindow SW_HIDE"

i want to know wher is the wrong in my steps , i will appreicated any
help

Where in your code do you execute the statement,

fSetAccessWindow SW_HIDE

?

I have a form that does this:

Private Sub Form_Open(Cancel As Integer)
Me.Visible = True
DoEvents
fSetAccessWindow SW_HIDE
End Sub

and it works fine, at least under Windows 2000.
 
H

HANA

hi Mr.Dirk

sorry for beeing laet in my reply
this code in the open form event in the Private Sub Form_Open(Cancel As
Integer)

but i'm sure that i'm missing somthing i don't know what & this something
make me feal that i'm so stupid!!:(

i'll appreicated if you walk with me from the beging

thank you Mr.Drik
 
D

Dirk Goldgar

HANA said:
hi Mr.Dirk

sorry for beeing laet in my reply
this code in the open form event in the Private Sub Form_Open(Cancel
As Integer)

but i'm sure that i'm missing somthing i don't know what & this
something make me feal that i'm so stupid!!:(

i'll appreicated if you walk with me from the beging

Please post (by copy/paste, not by manually typing it) the code from the
form's module, and verify that you have the form's PopUp and Modal
property set to Yes.
Also tell me what error message, if any, you get when the code runs. If
there's no error message, describe what happens that is in error.

Make sure also that the standard module containing Dev's
window-management code has a name that is different from any of the
procedures it contains.
 
H

HANA

hi Mr.Dirk

Private Sub Form_Open(Cancel As Integer)

Me.Visible = True
DoEvents
fSetAccessWindow Switch_HIDE
This is the code in the form event
and the error message alwayes come here "compile error variable not defind"
why not defind
& forgive me sir but i did't catch what you sid about the standard module
Dev's
can you be more specefic?
thank you
 
D

Dirk Goldgar

HANA said:
hi Mr.Dirk

Private Sub Form_Open(Cancel As Integer)

Me.Visible = True
DoEvents
fSetAccessWindow Switch_HIDE
This is the code in the form event
and the error message alwayes come here "compile error variable not
defind" why not defind

It looks to me like this line is the culprit:
fSetAccessWindow Switch_HIDE

I don't know where the word "Switch" came from. It should be:

fSetAccessWindow SW_HIDE

The error message is telling you that you used a variable name -- in
this case "Switch_HIDE" -- that you never defined in your code. The
error message is accurate, because that is not the correct name. The
correct name is "SW_HIDE".
 

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