Is It Possible To Do Make Table Query From Union Query ?

Nov 14, 2007

can't seem to be able to do so..

View Replies


ADVERTISEMENT

Queries :: Make A Union Query

Dec 18, 2014

I have two basic lists of employee names, ID's, phone numbers etc, with one field containing an attachment with a picture of their ID. I don't want to permanently combine these two lists of employees, as they work in different departments, but for certain events I need to be able to print a report with a list of all their names, ID numbers, and corresponding ID photos.

I tried to make a UNION query, but can't do it with the attachment field. If I leave that field out, it's no problem. To simplify, I have been doing a test run as follows, with just the name field and photo field (field 1).

SELECT [Starting Gate employees].[Employee name], [Starting Gate employees].Field2
FROM [Starting Gate employees]
UNION
SELECT [Farrier employees].[Employee name], [Farrier employees].Field2
FROM [Farrier employees];

View 2 Replies View Related

UNION Query MS Jet Database Engine Cannot Find The Input Table Or Query.

Oct 28, 2005

Hello All,

I'm trying to run a UNION query that joins five queries through a MS WorkSpace into a DAO.recordset in VB. I'm pulling the data from a SQL Server Database through VB in Access. I'm attempting to open a recordset with a query passed to it as a string. The query is below. For some reason, I'm receiving a message: "MS Jet database engine cannot find the input table or query. Runtime Error 3078".

Here's what's puzzling. When I run a single query without any UNION statement, the code finds the table and runs fine without error, but anytime I join two or more queries with a UNION statement in the VB, it gives me the error.

I've executed the same UNION query in both Access Query Builder and SQL Server's Query Analyzer and they work fine in both environments. It's only when I call the query from a DAO.Recodset with VB that it causes this problem. The following is a sample of the UNION query joining two of the five queries. Does anyone have any idea what could be the problem? The following query executes in about 5 seconds so I don't think there's a "time-out" issue. I'm thinking that the UNION statement may be the culprit. Maybe there's another way to approach joining these separate queries? Any help would be most appreciated. Thanks.

SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((CategoryID) = 'HCPROD') AND ((BrandID)<>'CSS')) AND (((BrandID)<>'1356')) AND (((BrandID)<>'1400')) AND (((BrandID)<>'1551')) AND (((BrandID)<>'555')) AND (((BrandID)<>'66'))
AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID
UNION
SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((ProductID) = '0029800')) AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID

Set wrkJet = CreateWorkspace("", "pw", "", dbUseJet)
Set db = wrkJet.OpenDatabase("DW", _
dbDriverNoPrompt, True, _
"ODBC;DATABASE=DW;DSN=DW2")
'Set rs1 = db.OpenRecordset(strSQL)

View 9 Replies View Related

General :: Combining Make Table With Union Queries

Aug 13, 2013

Wondering whether it is possible to use the 'Make Table' function in conjunction with a union query. My early attempts have failed and I am relatively new to Access.

I am using Access 2010.

View 2 Replies View Related

Queries :: UNION / UNION ALL Query Crashed Access

Oct 24, 2013

I'm having a problem with a UNION / UNION ALL query.It seems there is a application crash fault when running the query that MS are aware of and have issued a hot fix. Unfortunately it will take my IT dept some time to check and install the hot fix If they agree to do it at all.

Problem signature:
Problem Event Name: APPCRASH
Application Name: MSACCESS.EXE
Application Version: 12.0.6606.1000

[code]...

View 1 Replies View Related

Queries :: Update Table With The Value Of Union Query

Sep 25, 2013

I have a table with a field I want to update with the value of a Union Query

The field I want to update is Yes/No format and I can update using 0 or -1 OK.

However, when I link in the union query (and check that I only have 1 update result which is either 0 or -1) I get an error message saying that Operation must use an updatable query.

I guess this is referring to the Union Query (although I am trying to update the table and not the query.

In short - I want to update a table based on the value of a union query.

Code:
UPDATE tbl_StaMe_NGR_Subscription INNER JOIN qry_QDF_QRYDEF1 ON (tbl_StaMe_NGR_Subscription.EmailType = qry_QDF_QRYDEF1.Type) AND (tbl_StaMe_NGR_Subscription.AgentEmail = qry_QDF_QRYDEF1.Email)

Code:
SET tbl_StaMe_NGR_Subscription.Subscribed = [Subscription];

View 1 Replies View Related

Queries :: Unpivot Table With Union Query

Feb 2, 2014

I am using below Union Query to unpivot attached table. Basically this is a table with some clothes and their sizes (in yellow). Now my problem is that below query works well only when all sizes are in the same row but as per attachment I may have them potentially over three different rows.

I can determine which row is for which item based on size range column (in red) but I still do not know how to modify my query to look at different rows depending on value of size range column, especially that as you can see there are multiple values pointing out to the same size range i.e. 0-6 and 1-4 point out to Size Range 1.

Unfortunately I cannot change the layout of the table to have all sizes in one row

Code:
Select Field1, Field2, "0" as Size,Field3 as Qty from orderform where Field3 > 0;
Union All Select Field1, Field2, "1" as Size, Field4 as Qty from orderform where Field4 > 0;
Union All Select Field1, Field2, "2" as Size, Field5 as Qty from orderform where Field5 > 0;
Union All Select Field1, Field2, "3" as Size, Field6 as Qty from orderform where Field6 > 0;
Union All Select Field1, Field2, "4" as Size, Field7 as Qty from orderform where Field7 > 0;
Union All Select Field1, Field2, "5" as Size, Field8 as Qty from orderform where Field8 > 0;
Union All Select Field1, Field2, "6" as Size, Field9 as Qty from orderform where Field9 > 0;

View 9 Replies View Related

Union Query - How To Populate 5th Table With All Data From 4 Tables

Sep 24, 2014

I have 5 tables in access 2010, 4 of them have data in them and I need to populate the 5th table with all data from the 4 tables. I know you have to create a Union query, but i dont know the sql statement

Table 1 - data
table 2 - data
table 3 - data
table 4 - data
table 5 - combine data from table 1, table 2, table 3, table

View 4 Replies View Related

Extracting Data From Linked Db2 Table Using Access Make Table Query

Aug 29, 2006

Hi,
I am extracting data from linked db2 table using access make table query. First I create a select query and can view the linked db2 data, but when I change to a make table query I get an error message, "invalid argument", when I run the make table query. There is no selection critera specified. Has anyone had this happen? and Do you know a solution?

Thanks for your support
GinnyP

View 1 Replies View Related

If A Make-table Query Result Is Null, How To Have A Default Message Appear In Table ?

Jan 21, 2005

Hi everybody,

Beginner here needs help !

I'm building a make-table query for which if the result is null (no record correspond to the set of criterias), a default message like "there was no activity during the period" would appear in the table (not a message box...I need the message in the output table). The best I could think of is an IIF function but it doesn't seem to work... Is there any way to do this without using VBA?

Thanks in advance !

View 1 Replies View Related

Make Table Query

Dec 22, 2005

When using a make table query, can you include an ID tag. in the output table? if so how

View 2 Replies View Related

Make Table Query Help

May 15, 2006

:confused: I am using a Make Table Query to filter a Linked Excel Table. Is there a way to cut/drop the first 8 characters of the text out of one of the fields as it creates the new table?

Field NameExcel DataFinal Data
Model_NameLATITUDE D600D600

Also, the final table has two Relationships with two other tables. When I run the Make Table Query once a week, I have to break the relationship to get it to run. Is there an easier way to dial with this?

View 2 Replies View Related

Make-Table Query ??

May 19, 2006

Is there a way in a Make-Table query to tell the table to open when it's created? I would assume there is a function or SQL code that would do this, but I know very little SQL. Can anyone point me in the right direction? Thanks!

View 2 Replies View Related

Make Table Query

Aug 27, 2007

I have a database named NewUpdate.mdb. I have another database named MainDatabase.mdb. Almost all the tables in NewUpdate.mdb are linked tables that are in the MainDatabase.mdb file.

I've written a simple make-table query in NewUpdate.mdb that makes a backup of a table that is located in the MainDatabase.mdb file. (See code below.)

SELECT tblProviderRate.* INTO tblProviderRateSave
FROM tblProviderRate;

The only problem is that this new table is created in the NewUpdate.mdb file. I need the query to be stored in the NewUpdate.mdb file and the "new" table to be created/stored in the MainDatabase.mdb file.

This sound simple enough, but I'm drawing a blank as to what I need to do in order for this to occur. Can someone tell me what I'm leaving out??

Thanks,
CRhodus

View 2 Replies View Related

Make Table Query

Nov 26, 2007

How to make-table query to make a certain field a memo field instead of a text field? The reason I cannot use the text field is the limitation is 255 characters while I require 2000 characters?

View 4 Replies View Related

Make Table Query

May 28, 2006

Dear friend

I need your help desperatly. In my db, I am making a "make table query" to match some text.

Help me build this please.

First a form which has text box, where I will put in some words..
Then a make table query, which will have =[form]![name of form]![control name]
A report on same table.

Means when some one puts some words in text field of form, on pressing hit button, a like statement is automatically created in one field of query which matches those words and a table is generated from them. Result is report.

Hope this is clear, could you please help me build this?

View 14 Replies View Related

Make Table Query

Dec 7, 2006

How can I set a button in an MSExcel sheet to run MSAccess make table query?

Please help. Thanks.

View 2 Replies View Related

Make Table Query In A Report

Oct 31, 2005

How can I get a make-table query to run in a report?

View 6 Replies View Related

Make-table Query Property?

Apr 19, 2007

I am having trouble with a make-table query. I run a query that populates my website with data daily. I have a bunch of fields in the db that I wanted to be displayed as one field on the website, so in my query I concatenated them. My website is able to distinguish which fields are text and which are memos so I can display multiple lines. Everytime I run the query, it creates the concatenated field as a text field. Is there a way I can default this to a memo type?

Thanks.

View 1 Replies View Related

Make A Table From A Crosstab Query

Aug 24, 2007

I want to make a table from the results of a crosstab query and am struggling to find a way. Is this possible?

Any help gratefully received!

View 9 Replies View Related

Make Table Query With Primary Key

Mar 24, 2008

Hi,

Anyone has the idea of creating primary key in a table using make table query?

Thanks.:confused:

View 1 Replies View Related

Make-table Query With Index

Sep 22, 2005

I am creating a table with a make-table query. The only trouble is that I can't figure out how to designate which field will be the primary key. Is there a way to do this...... other than creating the table, then manually going into desing mode and specifying the primary key there? I want this to be automated.

Thanks,
David

View 3 Replies View Related

Make Table Query From Record Set

Dec 4, 2006

Hi,

Quick question: I am running a union query via a recordset.
How can I store the results in a new not yet defined table?

Cheers,

Gurkentopf

View 4 Replies View Related

Changing The Name Of The Created Table In A Make-Table Query

Sep 23, 2007

Dear Access Expert

I wanted to know if it is possible to change the name of the Table which is going to be created using a Make-Table Query via code (VBA).

For example if my Make-Table query currently creates a table with the name "Table1" I want to change it to name "Table2" and then change it Back to "Table1" or "Table3" etc.... depending on the users selection.

View 6 Replies View Related

Queries :: Make Table Query - Find Table Name

Oct 14, 2013

How can you determine the name of a table that has/is going to be created by a make-table?

View 2 Replies View Related

Union Query - Generating From A Select Query ?

Jun 23, 2006

(This is a modified repost - which hopefully makes sense) I am using Access2003. I am trying to set up a fast method of creating a union query. I have a jobs table that stores info about jobs with a separate table for each job that pulls together info from elsewhere when a review is conducted. The tables are as follows (and are linked from a paradox DB) :-

Table Name: jobs
JobID (J000001, J000002, etc)
Status (Live, Filled, etc)

Review Tables

Table Name: J000001 / J000002 etc
Consultant: (Joe, Terry etc)
ObjectID: (RoberI, SmithJ etc)
Status: (H, P, D, R etc)

The jobs table contains information about jobs, including a unique code (JobID) that identifies the job. There is also a status filed that tells us whether the job is Live or closed etc.

The first time a job is reviewed a new table, a review table is generated, and the name of the table is the same as the JobID for that job. So Job J000001 has a review table with table name J000001 etc. The review tables may contain information with the same ObjectID (as they are unique fields from a third table – the candidates table)

I would like to generate a union query for all jobs in table jobs with a status of live. I can do this manually, if I review a list of live jobs, with the following sql expression;

SELECT ObjectID, Consultant, Status, "J000001"
as [JobNo] FROM J000001
UNION SELECT ObjectID, Consultant, Status, "J000002"
as [JobNo] FROM J000002
UNION SELECT ObjectID, Consultant, Status, "J000003"
as [JobNo] FROM J000003;

I can then append the info into a new table. However this query is run at least twice a day and things change.

I would like to know is there a means of automatically generating sql for the union query based on results of a query of the jobs table ?

Any help greatly appreciated.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved