Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


using Left function to take first 5 character from a access field

Posted on 2004-11-02
Medium Priority
Last Modified: 2013-12-24
i have a text field named 'zip' in an access database that contains a zipcode such as "60101-0452".
the user enters a 5 digit zipcode in a form (i.e Form.password)
i want to be able to compare the first 5 digits of the 'zip' field to what the user entered.

<cfquery name="qname" datasource="dsname">
      SELECT * FROM table where username = '#Form.username#' AND zip = '#Form.password#'
Question by:Judy Deo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

kcm76 earned 1200 total points
ID: 12473458
try this.

select * .... and left(zip,5) = '#Trim(FORM.Password)#'

Assisted Solution

bwasyliuk earned 800 total points
ID: 12473491
How about...

<cfquery name="qname" datasource="dsname">
     SELECT * FROM table where username = '#Form.username#' AND LEFT(zip,5) = '#Form.password#'

I use MSSQL server, and did a sample query like this, and from a quick check I assume Access allows the same thing.

Here is my sample: select * from employee where left(lastname,2) = 'An'
Matches Anderson, Andrews, Anthony and so on.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question