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

x
?
Solved

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

Posted on 2004-11-02
2
Medium Priority
?
609 Views
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#'
      
</cfquery>
0
Comment
Question by:Judy Deo
[X]
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
2 Comments
 
LVL 5

Accepted Solution

by:
kcm76 earned 1200 total points
ID: 12473458
try this.

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

Assisted Solution

by:bwasyliuk
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#'
     
</cfquery>

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.
0

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