My Assistant
![]() ![]() |
|
|
Sep 21 2011, 08:53 PM
Post
#1
|
|
|
New Member Posts: 3 |
trying to get matching data from my query to insert into an existing table, nothing happens it just sits there, any ideas?
INSERT INTO Transactions ( [Asset Number], [Location Name] ) SELECT Books.[Asset Number], Books.[Location Name] FROM Books INNER JOIN Tabletest ON Books.[Asset Number] = Tabletest.[Asset Number] WHERE (((Books.[Asset Number]) Is Not Null)); |
|
|
|
Sep 21 2011, 08:56 PM
Post
#2
|
|
|
UA Admin Posts: 19,227 From: Newcastle, WA |
Are you sure the query finds records to insert? When you have this query in the query designer, select "Datasheet View" to see the records that will be inserted. Are there any?
|
|
|
|
Sep 22 2011, 09:18 AM
Post
#3
|
|
|
Retired Moderator Posts: 19,667 |
INSERT INTO Transactions ( [Asset Number], [Location Name] ) SELECT Books.[Asset Number], Books.[Location Name] FROM Books INNER JOIN Tabletest ON Books.[Asset Number] = Tabletest.[Asset Number] WHERE (((Books.[Asset Number]) Is Not Null)); The SELECT clause (which can be a SELECT SQL on its own) of the INSERT SQL will never return any row because of the contradictory conditions on the INNER JOIN and the WHERE clause. Thus, your INSERT SQL has nothing to append, ever. Suggest you first try the SELECT Query/SQL only until the SELECT Query/SQL returns the rows as required and then use the SELECT SQL as part of your INSERT SQL. Hint: Check your Access Help on LEFT JOIN / RIGHT JOIN operations. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th May 2013 - 11:56 AM |