Zip Codes Help!

C

Chris

Hey everyone,
I need to make a database that contains customer numbers and their zip
codes. some zip codes look like 48315-4552 and others that look lik VBFGHK.
For the Zip codes that look like 48315-4552 I just want to grab the first 5
charaters and for the zip codes that look like VBFGHK I just want to leave
alone. Here is the code I'm using:
IIf(Left([ALADDZ],10),Left([ALADDZ],5),[ALADDZ]) this isn't working I'm
just getting the first 5 charaters of each zip regardless. Can someone help
me out?

Thanks,
Chris
 
T

Tom Lake

Chris said:
Hey everyone,
I need to make a database that contains customer numbers and their zip
codes. some zip codes look like 48315-4552 and others that look lik
VBFGHK. For the Zip codes that look like 48315-4552 I just want to grab
the first 5 charaters and for the zip codes that look like VBFGHK I just
want to leave alone. Here is the code I'm using:
IIf(Left([ALADDZ],10),Left([ALADDZ],5),[ALADDZ]) this isn't working I'm
just getting the first 5 charaters of each zip regardless. Can someone
help me out?

Try this:
Iif(Left([ALADZZ], 1)>="0" And Left([ALADZZ], 1)<="9", Left([ALADZZ],
5), [ALADZZ])

Tom Lake
 
C

Chris

Thank you.


Gary Walter said:
try:

IIf(IsNumeric(Left([ALADDZ],5))=True,Left([ALADDZ],5),[ALADDZ])

Chris said:
Hey everyone,
I need to make a database that contains customer numbers and their zip
codes. some zip codes look like 48315-4552 and others that look lik
VBFGHK. For the Zip codes that look like 48315-4552 I just want to grab
the first 5 charaters and for the zip codes that look like VBFGHK I just
want to leave alone. Here is the code I'm using:
IIf(Left([ALADDZ],10),Left([ALADDZ],5),[ALADDZ]) this isn't working I'm
just getting the first 5 charaters of each zip regardless. Can someone
help me out?

Thanks,
Chris
 
C

Chris

Thank you.


Tom Lake said:
Chris said:
Hey everyone,
I need to make a database that contains customer numbers and their zip
codes. some zip codes look like 48315-4552 and others that look lik
VBFGHK. For the Zip codes that look like 48315-4552 I just want to grab
the first 5 charaters and for the zip codes that look like VBFGHK I just
want to leave alone. Here is the code I'm using:
IIf(Left([ALADDZ],10),Left([ALADDZ],5),[ALADDZ]) this isn't working I'm
just getting the first 5 charaters of each zip regardless. Can someone
help me out?

Try this:
Iif(Left([ALADZZ], 1)>="0" And Left([ALADZZ], 1)<="9", Left([ALADZZ],
5), [ALADZZ])

Tom Lake
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top