473,396 Members | 2,121 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,396 software developers and data experts.

east coast zip code problem

n8kindt
221 100+
most areas on the east coast have zip codes starting with 0... you can probably see where i'm going with this already.

i'm trying to relate these 2 databses:

1) TaxDB - an ODBC MySQL database (which is mainly used for our webstore) of every zip code and it lists all their tax info for city, county, and state.

2) CustomerDB - the database i have created and that we've been using for two months to store sales data and contact information

attempt #1: my customer zip field was originally text. i then converted CustomerDB.zip to an integer field. i then created a relationship between the TaxDB.zip and the CustomerDB.zip and the only problem was the "0" of every east coast customer ended up being omitted by the conversion. there seems to be no way to add this zero. i tried every single number format possible (long int, double, single, decimal) and nothing works.

attempt #2: i decided to make a query that first converts TaxDB.zip to a string using the CStr function. unfortunately, everyone of the east coast zip codes ended up returning #error while all the other zips worked fine.

so.... i am not sure what there is to do. is there a function i can use to convert TaxDB.zip to a string that properly converts the zero in string format? i am at a loss. i'd appreciate some input!! thanks guys

--nate
Jun 3 '08 #1
5 2639
Megalog
378 Expert 256MB
try:

format([Zip code field],"00000")

That will enforce the 5 digits, whether it starts with a zero or not.
Jun 3 '08 #2
RuralGuy
375 Expert 256MB
In addition to Megalog's excellent suggestion the rule of thumb is: "If you will not be using the numerical field for a math function then make it a Text field".
Jun 3 '08 #3
n8kindt
221 100+
try:

format([Zip code field],"00000")

That will enforce the 5 digits, whether it starts with a zero or not.
this didn't exactly work directly but i got it to work indirectly... rather than using this code on CustomerDB.zip i used it TaxDB.zip. rather than converting the number using
Expand|Select|Wrap|Line Numbers
  1. CStr([zip])
i used
Expand|Select|Wrap|Line Numbers
  1. CStr(Format([zip], "00000"))
i have my theories on why this worked but it would be hard to explain. basically, i believe access was returning an error on the zip codes that started with zero b/c it automatically converted the number into an integer BEFORE it converted it to a string. and so when the string came out and didn't look like what it started as, this triggered the #error to show.
Jun 4 '08 #4
n8kindt
221 100+
In addition to Megalog's excellent suggestion the rule of thumb is: "If you will not be using the numerical field for a math function then make it a Text field".
excellent advice. i definitely learned that for the future. unfortunately, the MySQL database was not created by me (and was part of a larger system--our webstore) so i couldn't do anything about the original number. i'm happy though b/c i got it to work perfectly. i just saved the company a bunch of money so we don't have to manually figure out whose zip code goes to what county and state and manually crunch the numbers accordingly ...a job that normally took 2 weeks is computed in 2 seconds :)

thanks guys for all your helpful replies!!
Jun 4 '08 #5
RuralGuy
375 Expert 256MB
Excellent! Glad we could help.
Jun 5 '08 #6

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

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
4
by: Kyler Laird | last post by:
In 2001 I attended the Python conference in Long Beach, CA. I had just decided that Python was something I should use and the conference provided me a (well-fitted) brainful of good insight....
242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
0
by: Wayan | last post by:
Geekcorps Volunteer - Systems Integration Kenya, East Africa Geekcorps http://www.geekcorps.org is in search of systems integration professionals experienced in developing communication systems...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
2
by: Vaux | last post by:
Anyone from Ukraine, East Europe or India here? I need someone on longer term that help me with learning VB and C#. I can open some small $20 bids by rentacoder or scriptlance for your patience....
2
by: savas_karaduman | last post by:
I supposed that creating graph with access would be as easy as how I could with Excel. But it seems to me that there is some tricky point here. What i am trying to do and what i got is as follow: ...
1
by: Denis McMahon | last post by:
I'm assuming that in php.ini, date.default_latitude is +ve North of the equator and -ve South, but what about date.default_longitude? -ve West and +ve East of Greenwich? or vice-versa? I know...
0
by: tradeinputian.005 | last post by:
Dear my friend It is our pleasure to meet you here. we are Sunrise East Asia Sporting Goods Co.,Ltd in Fujian of China. our website: http://www.trade-in-putian.cn
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:
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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...

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.