Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Select Replace in MS Access Queries

Question posted by: maryanncanor (Newbie) on July 25th, 2008 09:47 AM
Hi,

I have 3 tables. Table1, Table 2 and Table3.

How Can I update(only one time) Table 2 using the Mapping Table3 ?



Table 1 have the ff fields:
_______________________________
Transaction | ProductType | Product |
-----------------------------------------------------
001 | | X
002 | | Y


Table 2 have the ff fields:
_______________________________
Transaction | ProductType | Product |
-----------------------------------------------------
| | | |
| | | |


Mapping Table 3 have the fields:
___________________________________
| Productype1 | Productype2
-----------------------------------------------------------
11111111 | 22222222


Conditions:

If the Product field of Table 1 is equal to “X”:
Get Productype1 in Table 3 and Place it in ProductType field in Table2

If the Product is equal to “Y”:
Get Productype2 in Table 3 and Place it in ProductType field in Table 2


Here is my Query:

UPDATE Table2 SET Table2.Product = "1111111"
WHERE ((([Table1].Product)="X"));

I think this is incomplete, because, this is only applicable to 1 condition which is If Product is X, What if Product isequal to Y, Does it mean Another query should be made?

How Can I update(only one time) Table 2 using the Mapping Table3 ?

Is Select Replace applicable?

Thank you for taking time to help me.
Stewart Ross Inverness's Avatar
Stewart Ross Inverness
Forum Leader
1,137 Posts
July 26th, 2008
07:53 AM
#2

Re: Select Replace in MS Access Queries
Hi, and welcome to Bytes!

Thank you for taking the time to put in some details of your three tables, but unfortunately the data you have provided does not help us here. Could you post samples of actual data? As it stands the dummy data is too limited to give us much of a clue as to what you really want to replace with what.

In particular: what are the actual contents of mapping table 3? What are the real product types etc involved? Is Table 2 truly empty, as it appears to be from your post? Is there no content for Product Type in table 1, as it appears to be blank from what you have posted? What relationships (if any) exist between tables 1, 2 and 3, and what are the key fields of these tables?

-Stewart

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,759 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Microsoft Access / VBA Forum Contributors