append table query

C

chilli_Novice

I need to append the results of a query into a table and one of the fields
needs to have a value that is not a part of the query results. Is there a
way to do this?

e.g.
field 1, field 2, field 3, field 4(not in result of query)
apple, 1.59, 1.99, Fruit
orange, 1.49, 1.99, Fruit
grapes, 0.99, 1.29, Fruit
 
M

Michel Walsh

In SQL view:


INSERT INTO tableName (field1, field2, field3, field4)
SELECT field1, field2, field3, "Fruit"
FROM tableWithData



In other words, supply the missing field with the required expression, such
as, here, the string constant "Fruit".


In the query designer, make the append query, bring the three available
fields in the grid, and, for the fourth one, type "Fruit" in the first
line (or whatever expression fits). Fill the other elements of the grid, as
supplying the name of the fields that will receive the fields/expression in
the first line of the grid.


Vanderghast, Access MVP
 
C

chilli_Novice

Thanks for the help Michel that did the trick.

Michel Walsh said:
In SQL view:


INSERT INTO tableName (field1, field2, field3, field4)
SELECT field1, field2, field3, "Fruit"
FROM tableWithData



In other words, supply the missing field with the required expression, such
as, here, the string constant "Fruit".


In the query designer, make the append query, bring the three available
fields in the grid, and, for the fourth one, type "Fruit" in the first
line (or whatever expression fits). Fill the other elements of the grid, as
supplying the name of the fields that will receive the fields/expression in
the first line of the grid.


Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top