Unable to create the simplest appendy query

  • Thread starter Thread starter Faraz Azhar
  • Start date Start date
F

Faraz Azhar

Hello

I have a table in which I have data of many employees called
Employees. Fields are ID, EmployeeName, Designation, Sector, .....
etc.

Now I have another table; TableB. This table only has 3 fields: ID,
Text1, Text2.

I am trying to create an append query in which I want to search the
Employees table by the employee's name, then using that employees ID,
I want to add some text in TableB.

So in short, I want employee ID from Employees table by searching the
employee name, then I want to add a row in TableB which will have the
employee ID i just searched and some manually added texts.

My try to create SQL was this:

INSERT INTO TableB (ID, Text1, Text2)
SELECT Employees.ID, "my text1" As EXP1, "my text #2" as EXP2
WHERE Employees.EmployeeName = "Faraz";

I know its terribly incorrect. I cant figure it out. Kindly someone
please help me out here.
THANK YOU very much !
 
Hello

I have a table in which I have data of many employees called
Employees. Fields are ID, EmployeeName, Designation, Sector, .....
etc.

Now I have another table; TableB. This table only has 3 fields: ID,
Text1, Text2.

I am trying to create an append query in which I want to search the
Employees table by the employee's name, then using that employees ID,
I want to add some text in TableB.

So in short, I want employee ID from Employees table by searching the
employee name, then I want to add a row in TableB which will have the
employee ID i just searched and some manually added texts.

My try to create SQL was this:

INSERT INTO TableB (ID, Text1, Text2)
SELECT Employees.ID, "my text1" As EXP1, "my text #2" as EXP2
WHERE Employees.EmployeeName = "Faraz";

I know its terribly incorrect. I cant figure it out. Kindly someone
please help me out here.
THANK YOU very much !

The only problem I see is that you're not telling Access where to select the
employeeID *FROM*: Try

INSERT INTO TableB (ID, Text1, Text2)
SELECT Employees.ID, "my text1" As EXP1, "my text #2" as EXP2
FROM Employees
WHERE Employees.EmployeeName = "Faraz";
 
The only problem I see is that you're not telling Access where to select the
employeeID *FROM*: Try

INSERT INTO TableB (ID, Text1, Text2)
SELECT Employees.ID, "my text1" As EXP1, "my text #2" as EXP2
FROM Employees
WHERE Employees.EmployeeName = "Faraz";
--

             John W. Vinson [MVP]- Hide quoted text -

- Show quoted text -

Yes that worked. The FROM clause was missing from my sql. Thank you
sir!
 
Back
Top