Results 1 to 6 of 6
  1. #1
    Darlene1409 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    3

    Joined tables for query, but, not finding field if it starts with zero

    OK, I am stumped...I have a table with zip codes and installation cities in it and a table with addresses and zip codes...I joined the zip codes on the two tables and ran a query so the installation city will show up on the address table, but, Access ignores any zip codes that starts with a '0'. I already made sure the zip code field was text. It makes no difference whether I import the tables or link the tables to the original excel sheets. What am I missing???

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What does the SQL for your query look like?

  3. #3
    Darlene1409 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    3
    Quote Originally Posted by Darlene1409 View Post
    OK, I am stumped...I have a table with zip codes and installation cities in it and a table with addresses and zip codes...I joined the zip codes on the two tables and ran a query so the installation city will show up on the address table, but, Access ignores any zip codes that starts with a '0'. I already made sure the zip code field was text. It makes no difference whether I import the tables or link the tables to the original excel sheets. What am I missing???
    SELECT [POST Scrub List by Install City].[last name], [POST Scrub List by Install City].[first name], [POST Scrub List by Install City].street, [POST Scrub List by Install City].city, [POST Scrub List by Install City].state, [POST Scrub List by Install City].zip, [POST Scrub List by Install City].phone, [POST Scrub List by Install City].[iss date], [POST Scrub List by Install City].[Install City] INTO NJ
    FROM [POST Scrub List by Install City] INNER JOIN [Zip Codes2] ON [POST Scrub List by Install City].zip = [Zip Codes2].Zip
    WHERE ((([POST Scrub List by Install City].[Install City])="NJ"));

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try a LEFT JOIN rather than an INNER JOIN and I do not see where you are pulling any fields from the [Zip Codes2] table.

  5. #5
    Darlene1409 is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    3
    I have this same query for many states, however, the problem seems to be that it will not read the NJ zip codes that start with a '0'....I have imported the zip codes from an excel spreadhseet that lists zip codes for many states, but, it won't read NJ zips that start with '0'....I don't think my join is the problem as it works on all the other states....

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I think one of the tables is numeric but try this:
    Code:
       Dim MySQL As String
       MySQL = "SELECT " & _
               "[POST Scrub List by Install City].[last name], " & _
               "[POST Scrub List by Install City].[first name], " & _
               "[POST Scrub List by Install City].street, " & _
               "[POST Scrub List by Install City].city, " & _
               "[POST Scrub List by Install City].state, " & _
               "[POST Scrub List by Install City].zip, " & _
               "[POST Scrub List by Install City].phone, " & _
               "[POST Scrub List by Install City].[iss date], " & _
               "[POST Scrub List by Install City].[Install City] " & _
               "INTO NJ FROM " & _
               "[POST Scrub List by Install City] " & _
               "INNER JOIN [Zip Codes2] ON " & _
               "(Val([POST Scrub List by Install City].zip) = Val([Zip Codes2].Zip)) " & _
               "WHERE " & _
               "[POST Scrub List by Install City].[Install City]) = 'NJ' ;"
    The point I was trying to make earlier is that I can see no reason for the JOIN in this query since you are never using any fields in the [Zip Codes2] table for anything; or am I just missing something.

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

Similar Threads

  1. How to add ID 1 above table that starts with ID 2 ?
    By Plomo in forum Database Design
    Replies: 2
    Last Post: 09-03-2009, 12:19 PM
  2. Replies: 1
    Last Post: 07-07-2009, 01:00 PM
  3. Finding highest value in a text field
    By cdominguez in forum Queries
    Replies: 3
    Last Post: 06-02-2009, 09:39 AM
  4. FileSearch object not finding files
    By tdalber in forum Programming
    Replies: 3
    Last Post: 05-14-2009, 10:16 AM
  5. Finding data that doesn't match
    By dlhayes in forum Queries
    Replies: 1
    Last Post: 11-11-2006, 08:14 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