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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDW File says "Already in Use"

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I am using the security file from acces..All of the sudden i am getting an error stating. FILE ALREADY IN USE...does anyone know what causes that??

Thanks DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
Never had this problem before. Only thing I can think of is there could be a rogue '.ldb' file for the system.mdw file left on the drive from a previous session. Have fun! :eek:)

Alex Middleton
 
I have had this problem before when using a remote server. I could only think that maybe you have to wait a while for the ldb to disappear. I know when I had it (also had the db's ldb) I couldn't do anything for what seemed like an hour or so.
What happens if you try and delete this 'ldb' file when there is definatley no-one in it. This has worked for me in the past (but not normally).

Nick
 
yaa it happened to me yesterday when i was logged into my terminal server make some program changes...Then after about 3 hours it seemed to be fine..

Thanks DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
If you know the path and the name of the *.ldb file, shove it in place of Me!Combo27 and run this function. It'll tell you who Access "Thinks" is currently in the database. I left the orginal authot in the remarks cuz I'm not even gonna pretend I wrote this one......:)


Code:
Private Sub cmdExecute_Click()
    Dim varBuffer As Variant
    Dim intReturn As Integer
    Dim intI As Integer
    Dim strTemp As String
    Dim strLDB As String
    Dim lngOptions As Long
    
    Me![txtResults] = ""
    
    If Not IsNull(Me![Combo27]) Then
        strLDB = Me![Combo27]
        lngOptions = 2
        
        intReturn = GetComputerNames(strLDB, lngOptions, varBuffer)
        
        If IsArray(varBuffer) Then
            For intI = LBound(varBuffer) To UBound(varBuffer)
                strTemp = strTemp & varBuffer(intI) & "     "
            Next intI
            strTemp = strTemp & vbCrLf
            strTemp = strTemp & "# of Users = " & intReturn
        Else
            strTemp = varBuffer & vbCrLf & vbCrLf
            strTemp = strTemp & "Error Code = " & intReturn
        End If
        Me![txtResults] = strTemp
    End If
End Sub

Option Compare Database
Option Explicit

'*************************************************************

'This module is based in part on a VB4 sample that is referenced
'by the white paper "Understanding Jet Locking".  Instructions
'for this and other utilities can be referenced in that paper

'MSLdbUsr.DLL was written and developed by
'Kevin Collins (73760.1047@compuserve.com)
'and Bob Delavan

'This Access for Windows 95 sample was written and developed
'by Michael Kaplan (102363.1726@compuserve.com, or also at
'MichaelK_TSI@msn.com).

'*************************************************************

'You use the following constants with the LDBUser_GetUsers
'function's "nOptions" parameter below.
Public Const OptAllLDBUsers = &H1
Public Const OptLDBLoggedUsers = &H2
Public Const OptLDBCorruptUsers = &H4
Public Const OptLDBUserCount = &H8
Public Const OptLDBUserAuthor = &HB0B

'Takes a string array buffer, a currently existing database
'filename, and one of the above constants as its parameters.
'When successful it will return the number of people in the
'database or "0" if there are no people in it.  It returns a
'negative number in case of an error, and you can then use
'LDBUser_GetError to retrieve extended error information.
Declare Function LDBUser_GetUsers Lib "MSLDBUSR.DLL" _
  (lpszUserBuffer() As String, ByVal lpszFilename As String, _
  ByVal nOptions As Long) As Integer
  
'Takes the error code returned by another MSLDBUSR.DLL function
'call and returns the error text associated with that error.
Declare Function LDBUser_GetError Lib "MSLDBUSR.DLL" _
  (ByVal nErrorNo As Long) As String _
  

Function GetComputerNames(ByVal strMDB As String, _
                          ByVal lngOptions As Long, _
                          ByRef varArray As Variant) _
                          As Integer

'In:
'   strMDB      Name of MDB file (including MDB file type suffix)
'   lngOptions  The value of the OptMDB constant to be used.
'   varArray    A variant that will hold either the error code
'               and error message OR the array of user names that
'               was requested.
'Out:
'   On Success  The number of users (0-255) that meet the
'               specified criteria.
'   On Failure  The error code. Extended info can be retrieved
'               with LDBUser_GetError.
                
    Dim intReturn As Integer
    
    ReDim astrBuffer(1) As String
    
    strMDB = MDBName(strMDB)
    
    intReturn = LDBUser_GetUsers(astrBuffer, strMDB, lngOptions)
    
    GetComputerNames = intReturn
    
    If intReturn < 0 Then
        varArray = LDBUser_GetError(intReturn)
    Else
        varArray = astrBuffer()
    End If
End Function
Tyrone Lumley
augerinn@gte.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top