Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Location
    Up Nort' Wi
    Posts
    140

    Unanswered: Disappearing Indices?

    Using Access '97 I'm trying to perform a simple .seek for a match/noMatch criteria (I've done it a bajillion times in other forms in this database and it's worked flawlessly).

    Now, with this one table I get:
    "Run-time error '3015':
    'Item_Name' isn't an index in this table. Look in the Indexes collection of the TableDef object to determine the valid index names."

    I looked in the Indexes for the table, it is an indexed, non-duplicating field.

    I know it's spelled correctly (I copy/pasted it over from the table to my .seek method in a desperate attempt to find out what I'm doing wrong)

    It's opening the correct table AFAIK (If I change the table name in the open command it has a fit and blows up before hitting the rs.Index line)

    So I guess what I'm wondering is there a common bug that's in '97 that can cause this to happen or do I somewhere somehow have something flubbed?

    I'm hoping someone here is feeling more coherent than I am this Friday afternoon and has more experience with '97...I was trained in XP and 2000...'97 was before my time.

    Thanks,

    Sam, I need a beer!

  2. #2
    Join Date
    Aug 2009
    Location
    Up Nort' Wi
    Posts
    140
    Decided to throw the Function code up just to be on the safe side. It's just a fast and ugly support function to check the table before allowing the user to add a value in an attempt to minimize duplication at entry time.


    ------------------CODE-------------

    Private Function Test_Item(item As String)

    Dim db As Database
    Dim rs As Recordset

    Set db = CurrentDb
    Set rs = db.OpenRecordset("Item_Type")
    rs.Index = "Item_Name"
    rs.Seek "=", item

    If rs.NoMatch Then
    Test_Item = True
    Else
    Test_Item = False
    End If

    rs.Close
    db.Close

    End Function

    ---------------END CODE-------------

    Sam, yup...still need that beer

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Not sure it will help, but in your code you do not specify how the table has to be opened. Try: Set rs = db.OpenRecordset("Item_Type", dbOpenTable).

    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •