Connecting Tech Pros Worldwide Help | Site Map

Help INSERT INTO query

Chris Kettenbach
Guest
 
Posts: n/a
#1: Nov 13 '05
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


nib
Guest
 
Posts: n/a
#2: Nov 13 '05

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
Chris Kettenbach
Guest
 
Posts: n/a
#3: Nov 13 '05

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]


Closed Thread