Update table in other database

JNotenboom
04-14-2004, 06:53 AM
Hello,
Im trying to figure out what is wrong with this code:
====================
Set dbsBmLokaal = DBEngine.Workspaces(0).OpenDatabase("C:\db2.mdb")
strSqlBm = "Update Tabel1 IN 'C:\db1.mdb' "
strSqlBm = strSqlBm & " Set anaam = Tabel1.anaam "
strSqlBm = strSqlBm & " Where vnaam = Tabel1.vnaam "
dbsBmLokaal.Execute (strSqlBm)

====================
I have the code in a form in db1.mdb. I want to update Tabel1 from db1.mdb with the data of Tabel1 (yes, same name, same column names) from db2.mdb.

I suppose it has something to do with the where clause. What about the syntax?
I simply does not run, i.e. no error, no data update.

Any suggestions??

Regards,

Johan

GMan_NC
04-14-2004, 06:56 AM
Change your code to something like this

strSqlBm = strSqlBm & " Set anaam = '" & Tabel1.anaam & "'"
strSqlBm = strSqlBm & " Where vnaam = '" & Tabel1.vnaam & "'"


The way you had it written it was taking Tabel1.vnaam as a literal string, not the contents of the text box

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum