UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How Can I Get This Insert Into Working?    
 
   
token_remedie
post 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));
Go to the top of the page
 
+
GroverParkGeorge
post 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?
Go to the top of the page
 
+
vtd
post Sep 22 2011, 09:18 AM
Post #3

Retired Moderator
Posts: 19,667



QUOTE (token_remedie @ Sep 22 2011, 11:53 AM) *
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 the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 11:56 AM