On Tue, 19 Jun 2001 22:42:53 +0200, "Markus Pandur"
Quote:
>I want copy a existing "column(=field in german)1" from "database1" to an
>existing (or not) - What is easier? - "colomn2" in "database2". I would
>prefer to realize this with DAO but if it isnt possible I take what i get.
>Please be patient! I'm a beginner and my mother tongue is german, thats why
>it is sometimes not so easy for me to explain what i mean.
>Thank you,
>Markus
Markus,
Is this what you are trying to do?
Table1: Product_Ref
Product_Name
Product_Cost
in Database 1
Table2: Product_Ref
Product_Name
in database 2
Do you wnat to copy the Product_Cost column to Table2 in database 2?
It is probably important to know what kind od database you are using.
With SQL Server, you can modify a database using SQL. With Access,
most of these SQL commands do not work, and you should use the DAO
Create-type commands (eg CreateField), or ADOX if you want to use ADO.
To copy the whole of Table1 into another database using Access
datbases, you can use a SQL statement like
"INSERT INTO Table1 IN c:\data\database2.mdb SELECT * FROM Table1"
while connecting to Database1.
Richard.
Quote:
>> On Tue, 19 Jun 2001 08:08:19 +0200, "Markus Pandur"
>> >Hello!
>> >I would like to copy a field from one Table to another with VBCode. It is
>> >important that the data in this field gets also copied. It would also
>help
>> >me if you can tell me how to copy the whole table. If somebody knows how
>to
>> >realize this then answer me, please.
>> >nice greatings,
>> >Markus
>> Markus, we need more information.
>> Are you copying the field into a field in an existing row in Table 2,
>> or do you want to add it into a new row?
>> If it is in an existing row, how will you locate this row?
>> If it is to go into a new row, what do we put into the rest of the
>> fields in this new row? Do you in fact want to copy the whole row from
>> Table 1 to Table 2, not just one field?
>> The simplest thing is if you describe exactly what you are trying to
>> do, then we can give you a specific answer.
>> Copying the whole table is easy.
>> If both tables are in the one database, just open an ADO connection,
>> say Cn, and use this line of code:
>> Cn.execute "INSERT INTO Table2 SELECT * FROM Table1"
>> If table2 is in a different database, lets say "c:\data\Db2.mdb", then
>> use
>> Cn.execute "INSERT INTO Table2 IN c:\data\Db2.mdb " & _
>> "SELECT * FROM Table1"
>> Richard.