Re: Indexing a Table

From: Apple (Apple_at_discussions.microsoft.com)
Date: 10/28/04


Date: Thu, 28 Oct 2004 08:01:06 -0700

Yes, the connection opens ok. It stops at this line:
Tabl.Indexes.Append Indx

Thanks

"Val Mazur" wrote:

> Hi,
>
> If it works fine locally, then could be permissions for the network drive
> issue. Is you connection opened successfully?
>
> --
> Val Mazur
> Microsoft MVP
>
>
> "Apple" <Apple@discussions.microsoft.com> wrote in message
> news:989FEF85-2D29-4E6D-A2F4-0B3132734EB0@microsoft.com...
> >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
> >
>
>
>