Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2010 - execute append query to update 1 table from inputs of two other tables

Posted on 2016-07-27
7
Medium Priority
?
72 Views
Last Modified: 2016-10-07
I have an Access 2010 database with 3 tables (table1, table2, table3). I am trying to execute an Append query that inserts values from both table2 and table3 into table1. The conditions are this:

1 value from table2 (User ID) is inserted into table1 into a field called table1.UserID
46 values (all listed Task entries contained in table3) are to be inserted into a field called table1.TaskNumber

The goal is to have a list of tasks inserted into table1 for each user.
0
Comment
Question by:Mark2016
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
7 Comments
 
LVL 39

Accepted Solution

by:
PatHartman earned 1000 total points
ID: 41732139
INSERT INTO tbl3 ( field1, field2)
SELECT Table1.Field1, Table2.Field2
FROM Table1, Table2;

This query does a cross join which produces a Cartesian Product.  Every row in tbl1 is joined to every row in tbl2.

Open the QBE.
Add the two source tables.  Do not draw a join line.
Select the columns you want from each.
Change the query type to Append.
Map the source column names to the target columns if they are not the same.
Save the query.
0
 

Author Comment

by:Mark2016
ID: 41732211
If I need to only append table3 with table1 and table2 values where a table1 column is not Yes

How would that alter what you've described?
0
 
LVL 4

Assisted Solution

by:bfuchs
bfuchs earned 1000 total points
ID: 41732299
at the end of sql statement just add
where table1.field1 = false (if its a yes/no field)
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Author Comment

by:Mark2016
ID: 41740071
It's worth noting that the target table for the append query should not be visible/included in the Append Query.
0
 
LVL 4

Assisted Solution

by:bfuchs
bfuchs earned 1000 total points
ID: 41740111
Once you change the query to append, it will prompt you to select the target table, and will be displayed in SQL view, why exactly do you also need to see it in design view?
0
 
LVL 39

Assisted Solution

by:PatHartman
PatHartman earned 1000 total points
ID: 41740730
It's worth noting that the target table for the append query should not be visible/included in the Append Query.
I don't know what you are trying to say here.  It is possible to select rows from tblA and then append them to tblA although that is not what you requested.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question