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 | | | | 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 | | | | 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] |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
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 226,223 network members.
|