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

x
?
Solved

Access query to remove leading zeros

Posted on 2013-01-29
2
Medium Priority
?
505 Views
Last Modified: 2013-01-29
I have a search button where user type in and find the detailed in the form but what user does is when there are leading zeros like 0005,user type in 5 only and for 00222,user type in 222 but my query works only when user type in whole number like 00222 and 005.Please help as to make this query something like right function in sql.Thanks in advance

Here's my query-
SELECT [ABC].NNN
   ,[ABC].AAA
  FROM [ABC]
  WHERE ((([ABC].NNN) = [Enter AB]
         OR ([ABC].AAA) = [Enter AB]))
0
Comment
Question by:Josh2442
[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 85
ID: 38833040
I would assume your values are NOT on stored with a Numeric Datatype (you can't store number with leading 0's), so you can just use a LIKE comparator:

SELECT * ABC WHERE [NNN] LIKE '*" & Me.YourSearchValue & "*'"
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 1600 total points
ID: 38833042
SELECT [ABC].NNN ,[ABC].AAA
FROM [ABC]
WHERE [ABC].NNN Like "*" & [Enter AB] & "*"
OR [ABC].AAA Like "*" & [Enter AB] & "*"

Will get all those records where the characters entered in the input box are located anywhere within [AAA] or [BBB]
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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

610 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