How do I execute query strings built in code?

  • Thread starter Thread starter CedricCicada
  • Start date Start date
C

CedricCicada

Greetings!

I have a query that updates one database from information contained in
another. Here's the update query:

UPDATE [;database=annl_test_copy.rsm].Variables INNER JOIN NameMap ON
Variables.strOPCName=NameMap.RockwellName SET Variables.strOPCName =
NameMap.SiemensName;

I am putting together a form that a user can use to specify the
database to be updated and the column names to use as the key and
update sources. So, for example, a File Open dialog would be used to
ask the user to choose the database to update, and I'd have to insert
that database's name in place of "annl_test_copy.rsm" in the above
query. Can I do this, or do I need to use a Recordset object to
accomplish this?

RobR
 
That's not a valid SQL statement.

You can't indicate the database like that in Jet SQL.
 
Douglas is correct. To do what you want from a purely mechanical point of
view, you can build a string dynamically containing the specifications you
want, then execute that string as a SQL command.
 
Back
Top