SELECT INTO Question

  • Thread starter Thread starter Wanderer
  • Start date Start date
W

Wanderer

Hi:

I want to write a query which inserts a record entered into a main
table into other tables within a database.

The main table is productInfo and the productID is the primary key for
this table and the other tables (phasePort, phaseQuality,
phaseSubmission).

When a new record is created in productID, I want the other tables to
automatically have a matching productID inserted in their respective
fields.

Basically, this is a tracking database to monitor the development of
software in the following order:

Product information entered in productInfo table -> Product port
status entered into phasePorting -> Product QA status entered into
phaseQuality -> Product submission status entered into phaseSubmission

This way we can find out the development phase a product is in and
when will it clear that phase.

The query for Access that I came up with is below. But it says "Query
Input must contain atleast one table or query" and I am a bit lost on
this.

Will really appreciate any help I can get.

SELECT productInfo.productID AS productInfo_productID INTO
phasePort.productID AS phasePort_productID, phaseQuality.productID AS
phaseQuality_productID , phaseSubmission.productID AS
phaseSubmission_productID
FROM productInfo
WHERE phasePort.productID != productInfo.productID AND
phaseQuality.productID != productInfo.productID AND
phaseSubmission.productID != productInfo.productID;
 
Hi,

Try in separate queries:

INSERT INTO phasePort ( productID)
SELECT productID
FROM productInfo
WHERE ..........;

INSERT INTO phaseQuality ( productID)
SELECT productID
FROM productInfo
WHERE ..........;

INSERT INTO phaseSubmission ( productID)
SELECT productID
FROM productInfo
WHERE ..........;

Call all 3 queries from a macro.

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| From: (e-mail address removed) (Wanderer)
| Newsgroups: microsoft.public.access.gettingstarted
| Subject: SELECT INTO Question
| Date: 3 Aug 2004 10:13:32 -0700
| Organization: http://groups.google.com
| Lines: 37
| Message-ID: <[email protected]>
| NNTP-Posting-Host: 204.128.192.37
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1091553213 15730 127.0.0.1 (3 Aug 2004
17:13:33 GMT)
| X-Complaints-To: (e-mail address removed)
| NNTP-Posting-Date: Tue, 3 Aug 2004 17:13:33 +0000 (UTC)
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news.glorb.com!postnews2.google.com!not-for-mail
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.gettingstarted:153111
| X-Tomcat-NG: microsoft.public.access.gettingstarted
|
| Hi:
|
| I want to write a query which inserts a record entered into a main
| table into other tables within a database.
|
| The main table is productInfo and the productID is the primary key for
| this table and the other tables (phasePort, phaseQuality,
| phaseSubmission).
|
| When a new record is created in productID, I want the other tables to
| automatically have a matching productID inserted in their respective
| fields.
|
| Basically, this is a tracking database to monitor the development of
| software in the following order:
|
| Product information entered in productInfo table -> Product port
| status entered into phasePorting -> Product QA status entered into
| phaseQuality -> Product submission status entered into phaseSubmission
|
| This way we can find out the development phase a product is in and
| when will it clear that phase.
|
| The query for Access that I came up with is below. But it says "Query
| Input must contain atleast one table or query" and I am a bit lost on
| this.
|
| Will really appreciate any help I can get.
|
| SELECT productInfo.productID AS productInfo_productID INTO
| phasePort.productID AS phasePort_productID, phaseQuality.productID AS
| phaseQuality_productID , phaseSubmission.productID AS
| phaseSubmission_productID
| FROM productInfo
| WHERE phasePort.productID != productInfo.productID AND
| phaseQuality.productID != productInfo.productID AND
| phaseSubmission.productID != productInfo.productID;
|
 
Back
Top