Question : access error  3011

The exact error is Run-Time error '3011':
with on error goto err_handler commented out:
The Microsoft Jet database engine could not find the object ''.  Make sure the object .......

err.description is
3011 The Microsoft Jet database engine could not find the object ''.  Make sure the object exists and that you spell its name and the path name correctly. an error has occured in main  ( IT LOOKS LIKE TWO SINGLE QUOTES NOT ONE DOUBLE)

I am exporting an access table as a dbase IV table to update an existing dos application (I have lots to convert).  I have a case select statement exporting several tables.  I get this error on two of them.  I have stripped the code (I commented out most everthing I don't need and left basic functionality trying to find the null variable to no avail)  I left just the docd.transferdatabase line and set source, dest variables and it still dies on Case "Staff" and Case "Ticklers"  all other Case statements work fine.


I have a space in here somewhere I cannot find.

  Case "Ticklers"
                                Debug.Print " entering ticklers"
                'EXPORT TO G:\GO_SYS\TICKLERS.DBF
            source = "Ticklers"
            dest = "TICKLERS.DBF"
            Set td = db.TableDefs(source)
            'td.Fields("TotalBudgetDollars").name = "BUDGET"
            'td.Fields("Event_StartMonth").name = "START_MO"
            'td.Fields("Event_CompleteMonth").name = "COMP_MO"
            'str = "ALTER TABLE Ticklers DROP COLUMN [MEMO]"
             '  db.Execute str
            DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                    Debug.Print " Hit Ticklers"
                                Debug.Print "leaving ticklers"
                               

here is the entire sub proceedure

Public Sub main()
On Error GoTo err_handler
Dim td As TableDef
Dim str As String
Dim db As Database
            'make the vb code wait for the .bat file to complete file transfers
'Call ShellWait("G:\GO_SYS\BKUP_DBF.BAT", vbNormalNoFocus)
Set db = DBEngine(0).OpenDatabase(path & dbName)
'Debug.Print path & "dhhm.mdb"
Dim source, dest
Call removeRelationship(db)     'delete relationships from database
  For Each td In db.TableDefs
    Select Case td.name
        Case "Staff"
                    'CHANGE COLUMNS EmergcyContactPhone to PHONE, Delete NOTE:
                    'CHANGE WheresHeAt to WHERE
                source = "Staff"
                dest = "STAFF.DBF"
                Set td = db.TableDefs(source)
                Debug.Print td.name
                                                'drop the column
                str = "ALTER TABLE Staff DROP COLUMN [Note]"
                db.Execute str
                                                'rename columns
                td.Fields("WheresHeAt").name = "WHERE"
                td.Fields("EmrgcyContactPhone").name = "PHONE"
                  DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
               
                                    Debug.Print " leaving staff"
            Case "Clients1"
                                Debug.Print " entering clients"
                source = "Clients"
                dest = "CLIENTS.DBF"
                Set td = db.TableDefs("Clients")
                    'DELETE NOTE AND CHANGE LastUpdateDate to UPDATED
                    'EXPORT  TO G:\GO_SYS\CLIENTS.DBF
                                                    'drop the column
                    str = "ALTER TABLE Clients DROP COLUMN [Note]"
                    db.Execute str
                                                    'change column name
                    td.Fields("LastUpdateDate").name = "UPDATED"
                    str = ""
                    db.TableDefs.Refresh
                                                    'transfer the table to .dbf file
                    DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                Set td = Nothing
                                    Debug.Print "leaving clients"
               
            Case "Client Alternate Names1"
                                Debug.Print "entering client alt names"
                                'EXPORT TO G:\GO_SYS\CLNT_ALT.DBF
                source = "Client Alternate Names"
                dest = "CLNT_ALT.DBF"
                DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                                Debug.Print "leaving client alt names"
             
            Case "Engagements1"
            Debug.Print "entering Engagem"
                    'EXPORT TO G:\GO_SYS\ENGMENT.DBF
                source = "Engagements"
                dest = "ENGMENT.DBF"
                DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                                Debug.Print "leaving engagem"
               
              Case "Invoice Line Items1"
                                Debug.Print "entering inv line"
                    'EXPORT TO G:\GO_SYS\INV_LINE.DBF
                source = "Invoice Line Items"
                dest = "INV_LINE.DBF"
                Set td = db.TableDefs("Invoice Line Items")
                str = "ALTER TABLE [Invoice Line Items] DROP COLUMN [Memo]"
                db.Execute str
                DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                                Debug.Print "leaving inv line"
               
            Case "Invoices1"
                                Debug.Print "entering Invoices"
                    'EXPORT TO INVOICES.DBF
                source = "Invoices"
                dest = "INVOICES.DBF"
                DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                                Debug.Print " leaving Invoices"
           
           
            Case "Ticklers"
                                    Debug.Print " entering ticklers"
                    'EXPORT TO G:\GO_SYS\TICKLERS.DBF
                source = "Ticklers"
                dest = "TICKLERS.DBF"
                Set td = db.TableDefs(source)
                td.Fields("TotalBudgetDollars").name = "BUDGET"
                td.Fields("Event_StartMonth").name = "START_MO"
                td.Fields("Event_CompleteMonth").name = "COMP_MO"
                str = "ALTER TABLE Ticklers DROP COLUMN [MEMO]"
                   db.Execute str
                DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                        Debug.Print " Hit Ticklers"
                                    Debug.Print "leaving ticklers"
                                   
            Case "TimeSheets1"
                                    Debug.Print " entering timesheets"
                    'DELETE COLUMNS COMMENTS:
                    'EXPORT TO TIME_SHT.DBF
                source = "TimeSheets"
                dest = "TIME_SHT.DBF"
                Set td = db.TableDefs("Time Sheets")
                str = "ALTER TABLE Time Sheets DROP COLUMN [Comments]"
                db.Execute str
                str = ""
                DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                                Debug.Print "leaving timesheets"
                               
            Case "Work Codes1"
                                Debug.Print "Entering work codes"
                    'DELETE LONG DESCRIPTION EXPORT TO WRK_CDS.DBF
                source = "Work Codes"
                dest = "WRK_CDS.DBF"
                Set td = db.TableDefs("Work Codes")
                 str = "ALTER TABLE [Work Codes] DROP COLUMN [Long Description]"
                db.Execute str
                DoCmd.TransferDatabase acExport, "dBase IV", path, acTable, source, dest
                                Debug.Print " leaving workcodes"
    End Select
Next
exit_main:
   Exit Sub
err_handler:
        Debug.Print (Err.Number & " " & Err.Description & " an error has occured in main")
    Resume exit_main
End Sub

Answer : access error  3011

I am off home I'm afraid - the obvious question is:

Are you certain your it is working for the other tables?
Where does path & dbName come from? Unless they are public variables your code would defo fail here, p[robably with the error message you are receiving.
Although maybe unrelated, how come all the other case statements refer to TableName1 in the case statement and then TableName (without the 1) when instantiating the tabledef object?

I think the STOP method (or inserting a breakpoint ideally) is the best next step - we need to know the precise line that fails.
Random Solutions  
 
programming4us programming4us