I have a query (IpelaOrd_qry) that I am using to load data into a table (IpelaOrd_tbl)
but I am doing something wrong as it is not working as I would hope...
At first I set this up as a select query as shown in the code below:
and I was using the following to execute this query
but because this is a select query I was getting a run time error 3065
So then I changed it so that I would delete the contents of the table first and changed this to an
update query with the following:
and I use the following code to first delete the contents of the table and then run the update query:
Now the problem is that if I run the query manually it will load the data into the table as I would expect
but when I use the following code it doesn't load any data into the table.
Why the difference and how do I correct this?
Thanks
but I am doing something wrong as it is not working as I would hope...
At first I set this up as a select query as shown in the code below:
Code:
SELECT Ipela_tbl.ID, Ipela_tbl.PartNum, Ipela_tbl.Desc, Ipela_tbl.Type, Count_tbl.Count
FROM Count_tbl, NewData_tbl INNER JOIN Ipela_tbl ON NewData_tbl.[Ordered Item] = Ipela_tbl.PartNum
WHERE (((Count_tbl.Count)<=[NewData_tbl].[Ordered Quantity]));
and I was using the following to execute this query
Code:
strSq1 = "IpelaOrd_qry"
CurrentDb.Execute strSql
but because this is a select query I was getting a run time error 3065
So then I changed it so that I would delete the contents of the table first and changed this to an
update query with the following:
Code:
INSERT INTO IpelaOrd_tbl ( PartNum, Type, [Count] )
SELECT Ipela_tbl.PartNum, Ipela_tbl.Type, Count_tbl.Count
FROM Count_tbl, NewData_tbl INNER JOIN Ipela_tbl ON NewData_tbl.[Ordered Item] = Ipela_tbl.PartNum
WHERE (((Count_tbl.Count)<=[NewData_tbl].[Ordered Quantity]));
and I use the following code to first delete the contents of the table and then run the update query:
Code:
strSql = "Delete * From IpelaOrd_tbl" CurrentDb.Execute strSql strSq1 = "IpelaOrd_qry"
CurrentDb.Execute strSql
Now the problem is that if I run the query manually it will load the data into the table as I would expect
but when I use the following code it doesn't load any data into the table.
Why the difference and how do I correct this?
Thanks