Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zipcode Autofill. Need to verify only first 5 numbers????

Status
Not open for further replies.

Shadez

Programmer
Jul 5, 2001
57
US
Me!FCity = DLookup("City", "lkpZipCodes", "ZipCode = " & "'" & Me!FZipCode & "'")

That is currently what I have to lookup the field. I only require the first 5 numbers to be check though.

I know there is a way that would accomplish this. Stripping everything at the first 5 characters. It is a text field.

I have tried a few diffrent possibilities with no luck. if pissbile could you show in the above line how to accomplish this?

Me!FZipCode

is the result I need stripped down to the first 5 characters for comparison.
 
first off thanks for the quick response. I cut and pasted that code directly replacing mine. I ended up with and error though :(

Run Time Error 3075

Syntx Error In String IN Query Expression 'ZipCode = '01852'

any idea on whats happening here?
 
Still no go on that. Seems that the "'" is required due to this being a TEXT field.
 
Try this:

Const dQuote = """" 'sets dquote equal to a double quote

Me!FCity = DLookup("City", "lkpZipCodes", "ZipCode = " & dQuote & left(Me!FZipCode,5) & dQuote)


Good Luck
Maq B-)
<insert witty signature here>
 
Databaseguy and Maquis. Thanks for all the assistance on this. Maquis your last suggestion completed the code. Now it works just fine. Thanks once again to both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top