A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to update a field with the value from another table?



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2004, 02:51 PM
Chris
external usenet poster
 
Posts: n/a
Default How to update a field with the value from another table?

Hi,

I would like to know how to update a field with the value
from another field from another table?
For example:
I have Table1, StatusField.
and Table2, StatusField.
Let's say the Status field in Table2 can have values such
as "Completed", "In progress" or "Open"
I would like these values to be able to appear
automatically in Table1, StatusField.

I am also pretty new with Vb, so any help would be
appreciated.
Thanks
  #2  
Old May 11th, 2004, 09:25 PM
John Vinson
external usenet poster
 
Posts: n/a
Default How to update a field with the value from another table?

On Tue, 11 May 2004 06:51:55 -0700, "Chris"
wrote:

Hi,

I would like to know how to update a field with the value
from another field from another table?
For example:
I have Table1, StatusField.
and Table2, StatusField.
Let's say the Status field in Table2 can have values such
as "Completed", "In progress" or "Open"
I would like these values to be able to appear
automatically in Table1, StatusField.

I am also pretty new with Vb, so any help would be
appreciated.
Thanks


No VB is needed or appropriate in this case.

In fact, I'd say that the need to do this operation AT ALL is very
much suspect. It sounds like you're trying to store the Status field
redundantly in two tables - this will *always* leave you vulnerable to
update anomalies, such as the status being "Open" in one table and
"Complete" in the other! Can you not create a Query joining the two
tables to look up the current status?

If you do need to do this - and I'd appreciate an explanation of *why*
you would need to do so - the appropriate tool would be an Update
Query. Create a Query joining the two tables (you will need a Primary
Key as the joining field in the table you're trying to update), change
it to an Update query using the query type icon, and update
Table1.StatusField to

[Table2].[StatusField]


John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #3  
Old May 12th, 2004, 09:28 AM
Chris
external usenet poster
 
Posts: n/a
Default How to update a field with the value from another table?

Thank you for your reply,

I will try the query.
Cheers,
Chris.
-----Original Message-----
On Tue, 11 May 2004 06:51:55 -0700, "Chris"
wrote:

Hi,

I would like to know how to update a field with the

value
from another field from another table?
For example:
I have Table1, StatusField.
and Table2, StatusField.
Let's say the Status field in Table2 can have values

such
as "Completed", "In progress" or "Open"
I would like these values to be able to appear
automatically in Table1, StatusField.

I am also pretty new with Vb, so any help would be
appreciated.
Thanks


No VB is needed or appropriate in this case.

In fact, I'd say that the need to do this operation AT

ALL is very
much suspect. It sounds like you're trying to store the

Status field
redundantly in two tables - this will *always* leave you

vulnerable to
update anomalies, such as the status being "Open" in one

table and
"Complete" in the other! Can you not create a Query

joining the two
tables to look up the current status?

If you do need to do this - and I'd appreciate an

explanation of *why*
you would need to do so - the appropriate tool would be

an Update
Query. Create a Query joining the two tables (you will

need a Primary
Key as the joining field in the table you're trying to

update), change
it to an Update query using the query type icon, and

update
Table1.StatusField to

[Table2].[StatusField]


John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.