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 = ""
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 "user32" (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 "user32" (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 = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" 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 ("hide", False, False)
on the next row of the macro put this in the condition :-
fOSUserName()=">>your user id<<"
and set the action to 'run code' again with the action argument, function row to :-
fAccessWindow ("show", 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