Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to load a Form without loading access first.?

Status
Not open for further replies.

hoja

Technical User
Joined
Dec 3, 2003
Messages
102
Location
US
hi... So I have split my DB in Access (FE, BE) now my question is, how can I make the user, when they first click to login in the DB, for the Form to come up, instead of the whole MS Access thing?

cause now they have to have MS Access installed in their computers in order to view my DB, and then they have to open the FE and then they have to click on Forms, and then double Click the Form that contains the FE.
 
In Tools, Startup, you can select which form you want to be open when the db loads and if you want to hide the db window, along with other options.
 
Thank you, that helped alot
 
Ok this was great, but now I ran into a little problem, I unchecked the option that lets me view the menu (Tools/Startup) now I can't get that back on!! what would I do?
 
Not sure which option you are talking about and which menu you are talking about, but try having a look in Window - Unhide and see if there are any windows you can unhide, if not please tell me which option and menu you are talking about.
 
There's the option of closing the db and opening it while holding the SHIFT key down.

HTH Roy-Vidar
 
Hoja,
try this method, back up your db before doing this.
use this code to capture the user id :-
paste this into a module
-----------------------------------------
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = &quot;&quot;
End If
End Function
----------------------------------------------------

use the code above to find out what your user id is.


now paste this into a second module:-

-------------------------------------------------------

Option Compare Database
Option Explicit
Private Declare Function IsWindowVisible Lib &quot;user32&quot; (ByVal hwnd As Long) As Long
Dim dwReturn As Long

Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3

Private Declare Function ShowWindow Lib &quot;user32&quot; (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
If Procedure = &quot;Hide&quot; Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = &quot;Show&quot; Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = &quot;Minimize&quot; Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
End If
If StatusCheck = True Then
If IsWindowVisible(hWndAccessApp) = 0 Then
fAccessWindow = False
End If
If IsWindowVisible(hWndAccessApp) = 1 Then
fAccessWindow = True
End If
End If
-----------------------------------------------------------

the first module gets the user id.
the second hides or shows the db window

now create a new macro and call it autoexec. access looks for this macro and runs it before anything else when the database is opened.
set the first row, action of the macro to 'run code' and place this line in the action arguments, funtion row:-
fAccessWindow (&quot;hide&quot;, False, False)
on the next row of the macro put this in the condition :-
fOSUserName()=&quot;>>your user id<<&quot;
and set the action to 'run code' again with the action argument, function row to :-
fAccessWindow (&quot;show&quot;, False, False).
so what it will do is when the database is opened it will firstly hide the db window then check if its you if it is it will then show the window.
you can get around this by holding down the shift key, but there are ways of disabling the shift key as well. let me know if you need to know how to this.


Be ALERT - Your country needs Lerts
 
something i forgot to mention, all of your forms, reports etc have to be set to 'popup', or they will not be visible if the window is hidden.

Be ALERT - Your country needs Lerts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top