473,395 Members | 1,458 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,395 software developers and data experts.

Need a procedure in VBA (ms access)

Hi!
I have a table in an MS Access database with a field which keeps the address. The Address was not entered in a consistent way. ex: "24 strName, city..." or "city, zip, strName". There are many records in the table, more then 100k
I need a procedure/function/module to extract the strName from the field.Can it be done usind Instr? If so how?

Any help will be appreciated.
Oct 15 '16 #1
3 1176
ADezii
8,834 Expert 8TB
It would be helpful if you could possibly list variations on how the same address would be entered. No matter what Procedure we come up with, it will never be foolproof.
Oct 15 '16 #2
Oralloy
988 Expert 512MB
In this, I agree with ADezii - you will never be able to match all patterns for names correctly, but you can solve for all of your data.

I've done this before, and it took quite a few pattern matches to get through a large (ca. 100,000 records) database. I did not fully check every result, but my method left me with high confidence. I started by formulating a solution and testing it. Then, I would spot check the answers, and the failures, before adding additional capability. Here is a pseudo algorithm:
  1. Build a potential solution
  2. Run test
  3. Check result for positive answers, if there is a problem, rework the last solution so that the selection is better/smarter.
  4. Check the failures, dream up an enhancement to the selection, and add it to the soltuion.
  5. Restart at test (#2).

The structure of the code that I ended up with was:
Expand|Select|Wrap|Line Numbers
  1. If Match(input to pattern1) Then
  2.   Select fields and store. 
  3. Else If Match(input to pattern2) Then
  4.   Select fields and store. 
  5. Else If Match(input to pattern3) Then
  6.   Select fields and store.
  7. Else
  8.   ''--match failure
  9.   Report failure.
  10. End If
  11.  
Happy Hunting,
Oralloy
Oct 15 '16 #3
Oralloy,
I am not sure if I get this. Can you send me the 'If Match(input to pattern1) Then
Select fields and store'. I see as it is a function which takes argument the field.
Example:
? CHURCH HILL MEADOWS BLVD
BEECHWOOD RETIREMENT 1500 RATHBURN RD E
In the example above I need to extract just the street. I have a list for the correct streets that suppose to be correct and want to extract the street only from the Address field then once I have the streets separately in a new field to match against the correct streets.
I hope to get some help and will be truly appreciated
Oct 17 '16 #4

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

Similar topics

3
by: Jeffrey | last post by:
Good day all, I have seen so many postings dealing with MS Access as a security risk and other items, yet I see now clear reason why. I would really like someone to point me in the right...
3
by: Larry Woods | last post by:
Anyone have an Access 97 runtime? Or know where there's a download? There shouldn't be any problem giving me a copy since you can send it out free with any *.mdb/*mde. TIA, Larry Woods
5
by: Darren Smith | last post by:
Hi There, I have a shopping cart app that displays products along with a textbox (to enter quantity) and an image button to add the item to the shopping cart. Please explain why my below...
9
by: cj | last post by:
I'm trying to forge ahead with Visual Basic .Net but recently I've suffered several major set backs in demonstrating VB is the future and we should move from Visual FoxPro. I really need to find...
12
by: Karina | last post by:
Hello: I am taking over someone else's code and my users are experiencing tons of problems but when I try to go into the source code to edit and try to fix these problems, I realize that all the...
1
by: TexCube | last post by:
Hello everyone, I have an urgent question. Can data be pulled from an access database table to create a directory that can be printed out and bound together? I need to have each row of a...
1
by: SMS | last post by:
Hi, We have our web-site developed in classic ASP, and I need to add this additional feature on one of the pages to access a VB application. How can I do that? The VB application basically...
2
by: karrans | last post by:
Hi, I'm trying to debug some code where I'm trying to retrieve particular ranges in an excel sheet into an Access table, depending on the user selection of the range name in a combo box with a...
0
by: Michael Gendron | last post by:
I have a VB.Net Client that updates a VCHAR(MAX) fields with RTF text in an MS-SQL 2008 database. I want to use MS-ACCESS as a front end for users to write reports (its easier for them becuase they...
0
by: sambamurthy | last post by:
In DB1, i have a procedure which takes objects types as parametres (input & output) like below CREATE TYPE BCI.BCIWSR_ORD_ATTACH_REC_TYPE IS OBJECT ( category_name VARCHAR2(30),...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...

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.