Connecting Tech Pros Worldwide Help | Site Map

Help INSERT INTO query

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 04:04 AM
Chris Kettenbach
Guest
 
Posts: n/a
Default Help INSERT INTO query

Sorry for x-post. Using Access 2000, what is wrong with this syntax?

INSERT INTO Activity (
IDType, ID, ProjectID, ComponentID, SubComponentID, ProcessDate )
VALUES (
'Employee', SELECT EmployeeID FROM tbl1104Mess , 6, 28,341, #11/02/04#
)

The desired result is to place 1 record into Activity for each 1 record in
tbl1104Mess.
With all the literal values and the EmployeeID from tbl1104Mess. I get an
error when I execute this statement. Thanks for any feedback.

Regards,
Chris



  #2  
Old November 13th, 2005, 04:04 AM
nib
Guest
 
Posts: n/a
Default Re: Help INSERT INTO query

Chris Kettenbach wrote:[color=blue]
> Sorry for x-post. Using Access 2000, what is wrong with this syntax?
>
> INSERT INTO Activity (
> IDType, ID, ProjectID, ComponentID, SubComponentID, ProcessDate )
> VALUES (
> 'Employee', SELECT EmployeeID FROM tbl1104Mess , 6, 28,341, #11/02/04#
> )
>
> The desired result is to place 1 record into Activity for each 1 record in
> tbl1104Mess.
> With all the literal values and the EmployeeID from tbl1104Mess. I get an
> error when I execute this statement. Thanks for any feedback.
>
> Regards,
> Chris
>
>[/color]

Uh...the problem is you can't have a query in your values list like you do.

Try:

INSERT INTO Activity (IDType, ID, ProjectID, ComponentID,
SubComponentID, ProcessDate )
SELECT 'Employee', EmployeeID, 6, 28, 341, #11/02/04#
FROM tbl1104Mess

Also, I don't know Access formatting but I'd recommend putting your date
into a more standard format. Is that November 2nd or February 11th?

Zach
  #3  
Old November 13th, 2005, 04:04 AM
Chris Kettenbach
Guest
 
Posts: n/a
Default Re: Help INSERT INTO query

Nevermind, I figured it out, I just built it this way

INSERT INTO Activity(IDType, ID, ProjectID, ComponentID, SubComponentID,
ProcessDate)
SELECT "Employee" as IDType, EmployeeID as ID, "6" as ProjectID, "28" as
ComponentID,
"341" as SubComponentID, "11/02/04" as ProcessDate FROM
tbl1104Mess

That had the desired result. Thanks for reading!!!
Chris

"Chris Kettenbach" <chris@piasd.org> wrote in message
news:Gd-dnbIv_rNzkRXcRVn-tA@giganews.com...[color=blue]
> Sorry for x-post. Using Access 2000, what is wrong with this syntax?
>
> INSERT INTO Activity (
> IDType, ID, ProjectID, ComponentID, SubComponentID, ProcessDate )
> VALUES (
> 'Employee', SELECT EmployeeID FROM tbl1104Mess , 6, 28,341, #11/02/04#
> )
>
> The desired result is to place 1 record into Activity for each 1 record in
> tbl1104Mess.
> With all the literal values and the EmployeeID from tbl1104Mess. I get an
> error when I execute this statement. Thanks for any feedback.
>
> Regards,
> Chris
>
>[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.