Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- MySQL insert records using MS Access
July 17, 2006, 3:42 pm
rate this thread
I have a MySQL database linked to an MS Access front-end.
I have an app which works fine with the local copy of the Access DB,
but when run with the linked tables for MySQL, it fails.
I'm trying to copy over related data for products, which is held in
The main copying of the producy works fine, just not any related
The part code I have is:
MySql1 = "INSERT INTO Related (product_ID, product_Ref, prod_relate) "
MySql1 = MySql1 & "SELECT " & NewProductID & " ,
Related.product_Ref, Related.prod_relate FROM Related "
MySql1 = MySql1 & "WHERE Related.product_ID = " & currentid
db.Execute MySql1, dbFailOnError
At present it hits the last line and fails ....... what am I doing
I import link the tables via ODBC.
The problem must lie in the SQL syntax ???? for MySQL
Re: MySQL insert records using MS Access
CREATE TEMPORARY TABLE temp_related LIKE Related;
INSERT INTO temp_related (product_id, product_ref, prod_relate)
SELECT & NewProductID &, r.product_ref, r.prod_relate
FROM Related AS r
WHERE r.product_id = & currentid;
INSERT INTO Related SELECT * FROM temp_related;
DROP TABLE temp_related;
I'll let you put in the quotes and stuff.
- » PreparedStatements with variable number of parameters
- — Next thread in » MySQL Database Forum
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum