Insert Into not working

lution

Registered User.
Local time
Today, 16:42
Joined
Mar 21, 2007
Messages
114
Code:
    'Add fields to existing tables
    Set dbs = OpenDatabase(dbPath)
    Set tdf = dbs.TableDefs("States")

    Set fld = tdf.CreateField("txtCountry", dbText, 50)
    tdf.Fields.Append fld
    dbs.TableDefs.Refresh
    
    dbs.Execute "Update States set txtCountry = 'US';"

     ' Load the new states
    dbs.Execute "Inert into States (shortstate, longstate, txtCountry) " _
        & "Select tblStates.shortstate, tblStates.longstate, tblStates.txtCountry from tblStates;"
    
    dbs.Execute "Drop table tblStates"
    dbs.Close

The code is properly adding tblStates to the dbPath database, adding txtCountry to the States table, updating the txtCountry for existing rows to 'US' and dropping the temporary table but it isn't loading the new rows from the tblStates table into States. I've confirmed that the property types match, including string length. Any ideas?

Thanks
Lution
 
You know how sometimes while you're asking the question, the answer comes to you? Well in posting I finally noticed I missed the 's' in insert.
 

Users who are viewing this thread

Back
Top Bottom