Unanswered: Query cannot be updated because from clause is not a single simple table name
I am using vb as front end and visual foxpro as back end for my
application. I am reading some data in excel and checking some fields with
my database and if match found i am updating the fields from excel to my
database. I am using find method for matching and after
the record get matched i try to update the fields from excel to db,
but it is throwing the error
"-2147418113 query cannot be updated because from clause is not a
single simple table name".
Here is my query
SQL = "select (Trim(N.RefNo) + Trim(N.AWBNo) + Trim(N.Name))
ComField, N.* from nmbpin N
nmbpin.Open SQL, mcnn, adOpenStatic, adLockOptimistic
SQL = Trim(xlsheet.Cells(Row, 3)) + Trim(xlsheet.Cells(Row, 2)) +
nmbpin.Find "ComField='" & SQL & "'"
If Not nmbpin.EOF Then
'updating the fields here
nmbpin.update // error occurs here
I am using single table without any joins.Can any one assist me whats
going wrong in my execution.
ADO is creating a calculated field (ComField,) which cannot be updated. (In effect, As far as ADO is concerned, it's like a type of join, entirely within a table...)
Instead of updating the recordset, build a SQL update statement, and use the connection.excecute method to run it.
You'll have to requery the recordset if you need to see the changes right away.
Last edited by loquin; 06-20-07 at 12:50.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert