How to fix error "3371: Cannot find table or constraint" when creating index?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dowlingm815
    New Member
    • Feb 2010
    • 133

    #1

    How to fix error "3371: Cannot find table or constraint" when creating index?

    I am attempting to create a table with an index. however, i am receiving an error code "3371: Cannot find table or constraint" as soon as it reads the "create index" statement. The code is as follows"

    thank you in advance for any guidance.

    Code:
    strSeqNumber_TEMP = " "
    strIndexOrg_TEMP = "0"
    strFund_TEMP = " "
    strAccountCode_TEMP = "0"
    strTotalPrice_TEMP = "0"
    strInd_TEMP = "0"
    strRuleCode_TEMP = "0"
    strSalesOrder_TEMP = "0"
    Dim tbl_IDT As DAO.TableDef
    Dim idxSeqNumber As DAO.Index
    
    
    
    '**** create output table
    'Delete temporary table
    DoCmd.RunSQL "DROP TABLE tbl_IDT;"
        
    'Create temporary table
    CurrentDb.Execute ("CREATE TABLE tbl_IDT(SeqNumber smallint, IndexOrg smallint, " & _
                                            "Fund VARCHAR(6), " & _
                                            "AccountCode smallint, " & _
                                            "TotalPrice money, " & _
                                            "Ind VARCHAR(1), " & _
                                            "RuleCode VARCHAR(6),  " & _
                                            "SalesOrder numeric)")
    
    
     DoCmd.RunSQL "CREATE INDEX idxSeqNumber ON tblIDT (SeqNumber) WITH PRIMARY"
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Your table is named tbl_IDT in the create table statement but you're trying to create an index on table tblIDT.

    But the real question is why are you dropping the table and recreating it?

    Comment

    • dowlingm815
      New Member
      • Feb 2010
      • 133

      #3
      Thanks for the fresh eyes!

      Comment

      Working...