473,413 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Access Query with Conditional Lookup. How?

Hi,

I have this scenario
- 2 separate db's (filename = dbOne.mdb" and "dbTwo.mdb") both with a
table called tblMapped in it

dbOne.tblMapped looks like:
----------------------------------------------------------------------------------------
ID (autonumber) | Source_System | Description
---------------------------------------------------------------------------------------
1 | dbOne | ABC123
2 | dbOne | ASD234
3 | dbOne | JSH134
dbTwo.tblMapped looks like:
----------------------------------------------------------------------------------------
ID (autonumber) | Source_System | Description
---------------------------------------------------------------------------------------
1 | dbTwo | ZZZ123
2 | dbTwo | GFR456
3 | dbTwo | HTER34

I then have 1 other db (consolidate.mdb) which consolidates all of this
into one tblMapped_final which looks like this.

----------------------------------------------------------------------------------------
ID (autonumber) | Source_System | Description
---------------------------------------------------------------------------------------
1 | dbOne | ABC123
2 | dbOne | ASD234
3 | dbOne | JSH134
1 | dbTwo | ZZZ123
2 | dbTwo | GFR456
3 | dbTwo | HTER34
Now I want to run a query from this tblMapped_final but depending on
the "source_system" value, I want it to look in different tables. ie.
if source_system is "dbOne" then I want it to find the record with ID =
1 from dbOne, not from dbTwo.

Is something like this possible from within MS Access or even writing
some VBA codes?

Thanks.

Aug 28 '06 #1
1 6445
A DLookup() could do it, using the value in the Source_System field for the
name of the table:

DLookup("Description", [Source_System], "ID = 1")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<ja********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>
I have this scenario
- 2 separate db's (filename = dbOne.mdb" and "dbTwo.mdb") both with a
table called tblMapped in it

dbOne.tblMapped looks like:
----------------------------------------------------------------------------------------
ID (autonumber) | Source_System | Description
---------------------------------------------------------------------------------------
1 | dbOne | ABC123
2 | dbOne | ASD234
3 | dbOne | JSH134
dbTwo.tblMapped looks like:
----------------------------------------------------------------------------------------
ID (autonumber) | Source_System | Description
---------------------------------------------------------------------------------------
1 | dbTwo | ZZZ123
2 | dbTwo | GFR456
3 | dbTwo | HTER34

I then have 1 other db (consolidate.mdb) which consolidates all of this
into one tblMapped_final which looks like this.

----------------------------------------------------------------------------------------
ID (autonumber) | Source_System | Description
---------------------------------------------------------------------------------------
1 | dbOne | ABC123
2 | dbOne | ASD234
3 | dbOne | JSH134
1 | dbTwo | ZZZ123
2 | dbTwo | GFR456
3 | dbTwo | HTER34
Now I want to run a query from this tblMapped_final but depending on
the "source_system" value, I want it to look in different tables. ie.
if source_system is "dbOne" then I want it to find the record with ID =
1 from dbOne, not from dbTwo.

Is something like this possible from within MS Access or even writing
some VBA codes?

Thanks

Aug 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: neblackcat | last post by:
Would anyone like to comment on the following idea? I was just going to offer it as a new PEP until it was suggested that I post it here for comment & consideration against PEP 308. I'm far...
3
by: David | last post by:
We recently translated the backend db from Access(97) to SQL Server. We are still using Access frontends. I have an update query in the Access front end that uses a lookup table to populate...
8
by: Vladimir | last post by:
Hello, I have a table in MS Access database. It has one field (with BYTE datatype) that has several properties set in Lookup tab of table Design View. Display Control = Combo Box. Row Source...
30
by: Andante.in.Blue | last post by:
I just browsed through some of my Access links when I came across the Ten Commandments of Access (http://www.mvps.org/access/tencommandments.htm). Some of the points I heartily agree with (and...
3
by: pbbriggs | last post by:
I will try to be as descriptive as possible, but this error has me stumped and I am not sure what relevant info to include.... I am running Access XP on a Windows XP machine. I initially began...
2
by: sparks | last post by:
I have a table with data like this id data data data lookup 1 ### ### ### 1 1 ### ### ### 12 I need to put this in 2 subforms...
8
by: Olov Johansson | last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7 and Konqueror 3.5) has support not only for standard function definitions, function expressions (lambdas) and Function...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
3
by: RLN | last post by:
Re: Access 2003/Oracle 9i I have an Access app that connects to an Oracle DB via OLEDB/VBA code (no DSN or ODBC) Queries against straight Oracle tables run fine. For this query, however,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.