Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Error when programmatically setting Index

extorextor Member Posts: 2
[b][red]This message was edited by extor at 2004-10-25 19:15:35[/red][/b][hr]
[b][red]This message was edited by extor at 2004-10-25 8:36:19[/red][/b][hr]
I need help on Access 2002!!!!!

I have a simple code to adds index to a table if the index is not set. It works ok when I run it from my pc( database on my c drive), but when I try to run it from a network drive I'm getting the error below:


Runtime error -214721785(80040e40):
The database engine could not lock table 'Combined Table' because it is already in use by another person or process.


There's no other person using the database.. so, I'm the only one using it when I received the error msg. See the code at the end..

Please help!!

Thanks




Private Sub SetIndex()

Dim Cat As ADOX.Catalog
Dim Tabl As ADOX.Table
Dim Indx As ADOX.Index

Set Cat = New ADOX.Catalog
Set Tabl = New ADOX.Table
Set Indx = New ADOX.Index

Cat.ActiveConnection = CurrentProject.Connection
Set Tabl = Cat.Tables("Combined Table")
If Tabl.Indexes.Count > 0 Then
Exit Sub
End If
DoCmd.Hourglass True
Indx.Name = "Myf"
Indx.Columns.Append ("Social_Security_Number")
Tabl.Indexes.Append Indx
DoCmd.Hourglass False
End Sub




Comments

  • bmiller1222bmiller1222 Member Posts: 107
    : [b][red]This message was edited by extor at 2004-10-25 19:15:35[/red][/b][hr]
    : [b][red]This message was edited by extor at 2004-10-25 8:36:19[/red][/b][hr]
    : I need help on Access 2002!!!!!
    :
    : I have a simple code to adds index to a table if the index is not set. It works ok when I run it from my pc( database on my c drive), but when I try to run it from a network drive I'm getting the error below:
    :
    :
    : Runtime error -214721785(80040e40):
    : The database engine could not lock table 'Combined Table' because it is already in use by another person or process.
    :
    :
    : There's no other person using the database.. so, I'm the only one using it when I received the error msg. See the code at the end..
    :
    : Please help!!
    :
    : Thanks
    :
    :
    :
    :
    : Private Sub SetIndex()
    :
    : Dim Cat As ADOX.Catalog
    : Dim Tabl As ADOX.Table
    : Dim Indx As ADOX.Index
    :
    : Set Cat = New ADOX.Catalog
    : Set Tabl = New ADOX.Table
    : Set Indx = New ADOX.Index
    :
    : Cat.ActiveConnection = CurrentProject.Connection
    : Set Tabl = Cat.Tables("Combined Table")
    : If Tabl.Indexes.Count > 0 Then
    : Exit Sub
    : End If
    : DoCmd.Hourglass True
    : Indx.Name = "Myf"
    : Indx.Columns.Append ("Social_Security_Number")
    : Tabl.Indexes.Append Indx
    : DoCmd.Hourglass False
    : End Sub
    :
    :
    :
    :
    :
    well, i am sorry to tell you, but on a networked environment you really are not the only one using a file. your computer automatically creates, for security reasons, different users and permissions. these can be thought of as user accounts in a way. when you are using a computer in a networked environment, your have permissions for different things such as accessing files and browsing the internet, so when you open a connection to the database it seems as though there is only one person using the file, being you, but in fact, the computer is the only one using the file, and the computer is on a network, therfore the computer and the network are both using the file, so to speak.
Sign In or Register to comment.