Results 1 to 11 of 11
  1. #1
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25

    Formatting Addresses in Large Database (Picture)

    I have a very large database of Addresses, and I need to format them correctly for a mail merge to be mailed at a later date.
    The problem is the city inputs the address with 0 place holders.

    The address can contains up to 6 zero value place holders for the house number. 000000

    For Example: The address 601 Greenhill will read "000601 Greenhill" in the database. I need to remove any consecutive 0 place holder values from the address beginning of the address.



    00
    7701 becomes 7701 (2 consecutive zeros removed)
    000608 becomes 608 (3 consecutive zeros removed)
    012198 becomes 12198 (1 zero removed)

    But its very important to note, it can only remove consecutive zeros from the beginning of the address.
    For example:
    068001 cannot remove the 0's in red, only the zero at the beginning of the address. Because the 00 in 68001 is part of the address.

    See Example from Database below:

    Click image for larger version. 

Name:	address.jpg 
Views:	13 
Size:	28.5 KB 
ID:	9835

    Please let me know if you require any clarification, or if you would like an example of the database.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I take it everything is in one text field, correct? What would you expect that last example on Anderson Blvd to be?

  3. #3
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    @RuralGuy,

    Yes everything is one text field. Examples such as Anderson Blvd are errors from the city employee who entered the information. In such cases, you have to manually look up the owner in the tax rolls to get the property address.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Are you part of the "city" organization? I ask because it seems someone has inputted data and not used a current Tax list of some sort. I would be requesting some sort of read only file derived directly from the Tax List.

    If you are not part of that organization, can you or your organization request a digital file based directly on the Tax list?

    You should not have to, nor should you, edit records on the Tax list.

    Perhaps more info is required, and I have misunderstood.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Here's a Function for a Standard Module that should help you:
    Code:
    Public Function StripLeadZeros(InValue As String) As String
       Dim MyStart As Integer
       Dim Looping As Boolean
       MyStart = 1
       Looping = True
       Do While Looping
          If Mid(InValue, MyStart, 1) = "0" Then
             MyStart = MyStart + 1
          Else
             Looping = False
          End If
       Loop
       StripLeadZeros = Mid(InValue, MyStart)
    End Function

  6. #6
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    Quote Originally Posted by RuralGuy View Post
    Here's a Function for a Standard Module that should help you:
    Pardon my ignorance, but this is my first attempt to use a function module in access. I googled around, but I am not having any luck. I tried to use your code by create ->module and pasting the code. I then debugged it to make sure it would work and it produced an error.

    What am I doing wrong? Also once the module is working correctly, how do I use it specifically on the property address column?
    Click image for larger version. 

Name:	error.jpg 
Views:	8 
Size:	125.8 KB 
ID:	9839

    @Orange, No I am not part of the city. This is the only file output you can obtain from the city.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    My bad. The code did not past as it should. I've changed it and highlighted the change in RED.

  8. #8
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    Quote Originally Posted by RuralGuy View Post
    My bad. The code did not past as it should. I've changed it and highlighted the change in RED.
    It went through debug no problems, thanks. Now that I saved this as a module, how do I run it on the "situs_address" column specifically to remove the leading zeros? Thank you very much with your help and patience.

    Click image for larger version. 

Name:	compiled.jpg 
Views:	6 
Size:	190.0 KB 
ID:	9842

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you want to make this change permanent then you could do an Update query and Set [situs_address] = StripLeadZeros([situs_address]). If just temporary then create a select query for all of the fields you need but add StripLeadZeros([situs_address]) As YourAddress and don't display the actual [situs_address] field.

  10. #10
    samanthaM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2012
    Posts
    25
    It appears to be working just fine. Thank you very much for your time and effort RuralGuy, this will help me very much in my day to day business needs.

    Thank you once again.

    Click image for larger version. 

Name:	example.jpg 
Views:	7 
Size:	65.9 KB 
ID:	9844

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Glad we could help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Putting Picture in database
    By adifa in forum Queries
    Replies: 12
    Last Post: 07-03-2012, 06:34 PM
  2. Replies: 7
    Last Post: 07-03-2012, 10:11 AM
  3. Replies: 5
    Last Post: 05-14-2012, 02:01 PM
  4. Replies: 1
    Last Post: 08-30-2011, 11:54 PM
  5. send email to email addresses in database?
    By cnstarz in forum Access
    Replies: 5
    Last Post: 03-02-2011, 09:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums