Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

access forms

ResolvedVersion 2007

Barry has attended:
Access Intermediate course
Access Advanced course
Access VBA course

Access 2007 Forms

What is a union query for?

Edited on Mon 30 Mar 2009, 12:09

RE: Access 2007 Forms

Hi Barry

The UNION query allows you to combine the result sets of 2 or more "Select" queries. It removes duplicate rows between the various "Select" statements. To create a UNION quey you have to write the SQL String manually on the SQL Window. You cannot use the design view.

Each SQL statement within the UNION query must have the same number of fields in the result sets with similar data types.

The syntax for a UNION query is:

Select field1, field2, . field_n
From tables
UNION
Select field1, field2, . field_n
From tables;

For Example:

Select Customer_Id
From Customers
UNION
Select Customer_id
From Orders;


In this example, if a Customer_Id appeared in both the Customers and Orders table, it would appear once in your result set.

The UNION query removes duplicates.

Hope this helps

Carlos

Thu 9 Apr 2009: Automatically marked as resolved.

Access tip:

Create own ribbon tab - Access 2010

a. In Access click on the File tab
b. Select Options from left hand side
c. Choose the Customize Ribbon section
d. Click the New Tab button (below the list of tabs on the right hand side of the dialog box)
e. Select the New Tab (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
f. Select the New Group (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
g. Add commands to your tab and group by locating them on the list on the right hand side (remembering that you can change the list using the drop down box at the top of the list of commands) and clicking the Add button between the two panes to add them to your tab and group
h. You can rearrange the commands in your group, the groups on any tab or the tabs, using the up and down arrow buttons beside the list of tabs.
i. Click OK to apply your changes

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.