update query

G

Guest

I have a table1 with date field. In this table1 there is always only one
record with some date in it.

I would like to take date from table1 and update this value to records in
table2

Please help!!!!
 
P

pietlinden

I have a table1 with date field. In this table1 there is always only one
record with some date in it.

I would like to take date from table1 and update this value to records in
table2

Please help!!!!

Maybe it's me, but what I get from this description is
CREATE TABLE Table1(Somefield,...,SomeDate,...);
CREATE TABLE Table2(Field1, Field2, ADateField,...)

You can JOIN the two tables on the date field... and then create an
update query... did you try it in the QBE grid? post your SQL...
(Open the query in design view, click the SQL button, copy and paste
it here.... Otherwise, can't help you.
 
J

John Spencer

Always only one record in the DateTable. Have you tried?

UPDATE Table2, Table1
SET Table2.SomeDateField = [Table1].[SomeDateField]

In Design view
-- Add both tables
-- Select the field you want to update
-- Select Query: Update from the menu
-- Enter [Name of table].[Name of Field] in the Update to "cell"
-- Select Query: Run

If there are more than one record in the date table but only one with a
date in the field then

UPDATE Table2, Table1
SET Table2.SomeDateField = [Table1].[SomeDateField]
WHERE Table1.SomeDateField is not null

And if you only want certain records in table 2 then add that to the
criteria also.

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

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