UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Returning Records Based On A Specific Character, Any Version    
 
   
azizrasul
post May 22 2019, 10:08 AM
Post#1



Posts: 1,458
Joined: 18-July 00
From: Faisalabad, Pakistan


I am trying to create a select query where only those records that contain 'A' should appear. No matter what I do, all the records that contain 'a' also appear.

--------------------
Aziz
Go to the top of the page
 
GroverParkGeorge
post May 22 2019, 10:14 AM
Post#2


UA Admin
Posts: 35,177
Joined: 20-June 02
From: Newcastle, WA


You need to use a case sensitive comparison.

How did you write the filter?

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
DanielPineault
post May 22 2019, 10:16 AM
Post#3


UtterAccess VIP
Posts: 6,671
Joined: 30-June 11



One solution is to use StrComp

CODE
SELECT *
FROM YourTableName
WHERE (((StrComp([YourFieldName],"A",0))=0));

--------------------
Daniel Pineault (2010-2018 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
azizrasul
post May 22 2019, 10:43 AM
Post#4



Posts: 1,458
Joined: 18-July 00
From: Faisalabad, Pakistan


DanielPineault, it returned no records.

GroverParkGeorge,

CODE
SELECT Table2.ID1, *
FROM Table2
WHERE (((Table2.ID1) Like '*' & Chr(65) & '*'));


Here are some sample records. It should return only the top 2 records.

Aa
Aziz
Rasul
This post has been edited by azizrasul: May 22 2019, 10:44 AM

--------------------
Aziz
Go to the top of the page
 
cheekybuddha
post May 22 2019, 11:03 AM
Post#5


UtterAccess VIP
Posts: 11,329
Joined: 6-December 03
From: Telegraph Hill


Are you using a Access BE? Definitely easier if you are using SQL Server, or another RDBMS.

--------------------


Regards,

David Marten
Go to the top of the page
 
azizrasul
post May 22 2019, 11:05 AM
Post#6



Posts: 1,458
Joined: 18-July 00
From: Faisalabad, Pakistan


For the moment just using a single MS Access database. No SQL server.

--------------------
Aziz
Go to the top of the page
 
cheekybuddha
post May 22 2019, 11:16 AM
Post#7


UtterAccess VIP
Posts: 11,329
Joined: 6-December 03
From: Telegraph Hill


CODE
SELECT
  *
FROM Table2
WHERE InStr(1, ID1, "A", 0) > 0;


The last argument (0) is vbBinaryComapre

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
ADezii
post May 22 2019, 11:17 AM
Post#8



Posts: 2,402
Joined: 4-February 07
From: USA, Florida, Delray Beach


Assuming your Table is named tblTest and your Field is named [Test Field]:
SQL
SELECT * FROM tblTest WHERE Instr(1,tblTest.[Test Field],"A",0) > 0;

Go to the top of the page
 
ADezii
post May 22 2019, 11:18 AM
Post#9



Posts: 2,402
Joined: 4-February 07
From: USA, Florida, Delray Beach


@cheekybuddha:
Sorry, beat me by a minute! laugh.gif
This post has been edited by ADezii: May 22 2019, 11:19 AM
Go to the top of the page
 
cheekybuddha
post May 22 2019, 11:22 AM
Post#10


UtterAccess VIP
Posts: 11,329
Joined: 6-December 03
From: Telegraph Hill


wink.gif

--------------------


Regards,

David Marten
Go to the top of the page
 
azizrasul
post May 23 2019, 03:04 AM
Post#11



Posts: 1,458
Joined: 18-July 00
From: Faisalabad, Pakistan


Thanks all, that worked.

--------------------
Aziz
Go to the top of the page
 
cheekybuddha
post May 23 2019, 04:26 PM
Post#12


UtterAccess VIP
Posts: 11,329
Joined: 6-December 03
From: Telegraph Hill


yw.gif

We're all pleased we could help!

thumbup.gif

d

--------------------


Regards,

David Marten
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    25th June 2019 - 11:44 PM