Copy from one table to another

C

Chris

Hi All, I know it sounds like a normalisation nightmare but it's not
(honest)

I have generated a query from access to select rows from a table. I would
like to copy these rows to another table by code ( code run by clicking
button on a form).

I'm really not sure of the syntax for this.

For one row I would have
Dlookup (value 1, Value2)
Insert into tbltable ( Column1, column2)
Values (value1, value2).

However, this will have multiple rows so it will have to be something like
select Query
Do Until query rows = 0
Insert into tbltable ( Column1, column2)
Values (value1, value2).
Loop
end Do

Could someone please fill in please?
 
G

Guest

I suggest you look in Access help for the syntax of the INSERT INTO statement.

You need something like
INSERT INTO ...
SELECT ...
FROM ...
WHERE ...

- Dorian
 
J

John Vinson

However, this will have multiple rows so it will have to be something like
select Query
Do Until query rows = 0
Insert into tbltable ( Column1, column2)
Values (value1, value2).
Loop
end Do

Could someone please fill in please?

You're thinking procedurally. Queries aren't procedural!

What you need is an Append query. Look up Append in the online help,
or just change your query to an Append query and read what's on the
screen!

John W. Vinson[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

Similar Threads


Top