473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Joining Like Fields in Access Query

43 New Member
Hello All,

I have 2 tables from 2 different data sources, where unfortunately the only fields able to be joined are street address, city, and state. Of those fields, obviously street address would work best. Unfortunately, since the 2 tables are from different data sources, one of which is from manual entry of POs, the street address will only join correctly about 50% of the time.

Ex.

Table1
Address | City | State
100 Main St | New York | NY
50 East 5th Ave | New York | NY

Table2
Address | City | State
100 Main Street | New York | NY
50 E 5th Ave | New York | NY

I have tried an inner join where Table1 Like Table2 & "*", but I either get 0 results (using the above example) or 4 results.

Any ideas if this is possible?

Thanks!
Apr 23 '14 #1
5 1768
zmbd
5,501 Recognized Expert Moderator Expert
Using a very simple database I think we can set you on the right path. The only difference will be that you will have to link the the two databases togeither, either within one or the other, or in yet a third.


In the attached there is a query, Qry_Using_Like_wild
DO NOT OPEN it using the GUI editor, it will puke.
Instead, run the query to see the results, and then right-click and select the SQL view.

First, Take a look at the two tables.
There are two forms, one that shows the info from the longname table and the other based on Qry_Using_Like_wild

What I've done is started out with a query like, qry_using_equal, by opening the standare GUI-Editor, adding the tables, and making the inner join.

I then switched to SQL view, changed out the equal sign in the join clause for the "Like" operator and appended the "*" wildcard.

Now this worked for my simple dataset; however, for yours there may need to be a more complex set of wildcards to get the best matching.

Once you have that down, go find someone that will help you to establish a standard dataentry form or to have common primary key between the two databases that will allow a much more effecent means of merging/handling the dataset.

I'm sure there's a better way to do this and either Rabbit or Neopa or one of the others should be along shortly to advise.
Attached Files
File Type: zip BytesThread_956257_JoiningOnLike.zip (126.6 KB, 74 views)
Apr 23 '14 #2
NeoPa
32,556 Recognized Expert Moderator MVP
This situation is, as Z says (but I'll paraphrase), to be avoided like the plague!

The pitfalls are numerous and serious. That said, there are approaches that can help reduce the problem, but at the cost of losing information. For instance, one thing that may work is to preprocess the data with a routine that converts all common abbreviations to their full counterparts. That way "Station Rd" will match "Station Road".

The best idea, of course, is never to get into this sort of situation in the first place ;-)
Apr 24 '14 #3
zmbd
5,501 Recognized Expert Moderator Expert
Neo, I was trying to be nice... plagues perhaps a little understated: think; ebola, or mustard-gas, golfing in the middle of landmines, locust, fire and ice from the sky, 40 days and nights of rain.

and with that my hopes for a good easy solution start to crash in the event horizon of the nearest super-massive-blackhole.
Apr 24 '14 #4
Lynch225
43 New Member
Haha, I completely agree (and thank you for the honesty). Eventually this process will be changed to have each store have its own unique number, which will solve this nasty problem. Unfortunately, as this is a new role I am in and there is an extremely time sensitive nature to getting this information together, I do not have the time I would like to fix the root cause of the problem.

I did manage to put a quick fix in by adding a zip code field in each data source and joining those fields. Then in the criteria for the address, I used:

Expand|Select|Wrap|Line Numbers
  1. Like '*' & Mid(Table2.Address,Instr(Table2.Address," "),8) & '*'
This allows at least a partial match in address, starting with the street name. This is a temporary fix that has solved all of my issues so far, but unfortunately I know there will be cases where this join may not work. It may be a used gas mask, but hopefully it prevents most toxic chemicals from entering my lungs :)

Thanks for the responses!
Apr 24 '14 #5
NeoPa
32,556 Recognized Expert Moderator MVP
I hear you Lynch. Many of us have been there. I even had to work with such data coming from three data sources where only the one that I managed was remotely reliable. That's when I thought out the conversion approach that cancelled out most of the more common aliases for address and company terms. It worked pretty well but was never 100% reliable.

Good luck. It sounds like you're as much on top of it as can be reasonably expected.
May 1 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Omavlana | last post by:
Hi, How to get the value as 0 insted of NULL if there is no data found in the database for a particular column in the following Access query. select col1, col2 from tab1; If there are null...
8
by: s_wadhwa | last post by:
SELECT DISTINCTROW "01C" AS dummy, Buildings.BuildingNumber, UCASE(Buildings.BuildingName) AS BuildingName, Buildings.MasterPlanCode, Buildings.UniformBuildingCode,...
3
by: austin1539 | last post by:
I am trying to run an Access query from Excel. The query, called "ProdActs1" works in Access and is run from using information from a table called "Queries". When a button is clicked in Excel, data...
2
by: k-man | last post by:
Hi: I have an MS Access query for a table called MyTable. One of my fields in the query is a custom field that looks like "MyField: = MyFunction(ID)" where ID is a field in MyTable. I have...
1
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am...
1
by: christianlott1 | last post by:
I used the code here: http://groups.google.com/group/comp.databases.ms-access/browse_thread/thread/4945db8db0321704/b918febe2ab9eda5?lnk=gst&q=list+fields++of+query&rnum=1&hl=en#b918febe2ab9eda5 ...
6
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one...
15
by: OzNet | last post by:
I have a query (with calculated fields) in Access (2007) and the data changes depending on the dates and staff person selected. I need to produce a series of graphs based on the data in this query...
2
by: mburns | last post by:
Hello all- I was wondering if it is possible to link an Access query or table to a Word document and pull specific information into Word by manually entering a unique identifier, which would then...
13
by: brentg | last post by:
I am using Access 2007. I am trying to calculate in an access query the median of six test scores for each student. Some students will not have all scores and the value of the field would be null. ...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.