473,498 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

duplicate records Query help

19 New Member
I have a query that checks for duplicate records on 2 fields. the issue I am having is that the data unfortunately is case sensitive. So M != m but the query is case insensitive. Is there a way to make my query case sensitive so I can cancel out the False positives from the query?

here is the quey if that helps

Expand|Select|Wrap|Line Numbers
  1. SELECT tblPreReleaseData.From_Conn, tblPreReleaseData.From_term, tblPreReleaseData.Serial_number, tblPreReleaseData.Drawing_Number, tblPreReleaseData.Wire_number, tblPreReleaseData.Revision
  2. FROM tblPreReleaseData
  3. WHERE (((tblPreReleaseData.From_Conn) In (SELECT [From_Conn] FROM [tblPreReleaseData] As Tmp GROUP BY [From_Conn],[From_term] HAVING Count(*)>1  And [From_term] = [tblPreReleaseData].[From_term])))
  4. ORDER BY tblPreReleaseData.From_Conn, tblPreReleaseData.From_term;
  5.  
  6.  
any help is appreciated

CG
May 21 '07 #1
11 2390
JConsulting
603 Recognized Expert Contributor
I have a query that checks for duplicate records on 2 fields. the issue I am having is that the data unfortunately is case sensitive. So M != m but the query is case insensitive. Is there a way to make my query case sensitive so I can cancel out the False positives from the query?

here is the quey if that helps

Expand|Select|Wrap|Line Numbers
  1. SELECT tblPreReleaseData.From_Conn, tblPreReleaseData.From_term, tblPreReleaseData.Serial_number, tblPreReleaseData.Drawing_Number, tblPreReleaseData.Wire_number, tblPreReleaseData.Revision
  2. FROM tblPreReleaseData
  3. WHERE (((tblPreReleaseData.From_Conn) In (SELECT [From_Conn] FROM [tblPreReleaseData] As Tmp GROUP BY [From_Conn],[From_term] HAVING Count(*)>1  And [From_term] = [tblPreReleaseData].[From_term])))
  4. ORDER BY tblPreReleaseData.From_Conn, tblPreReleaseData.From_term;
  5.  
  6.  
any help is appreciated

CG

change the fields to UCase([yourfield])

makes everything upper case
May 21 '07 #2
Rabbit
12,516 Recognized Expert Moderator MVP
change the fields to UCase([yourfield])

makes everything upper case
Actually, they want the opposite of this, a case sensitive compare.

Use StrComp(string1, string2, compare) where compare = 0 or vbBinaryCompare. If they match completely it'll return 0
May 21 '07 #3
cgrider
19 New Member
change the fields to UCase([yourfield])

makes everything upper case
thank you for your response, but what I am trying to do is to make sure not to capture the data that the only difference is the casing of the values. for example

record1
Field1= 1234
Field2=m

record2
Field1=1234
Field2=M

Record3
Field1=1234
Field2=m

what I need is
Record1 = Record3
but Record1 <> Record2 or Record2<>Record3

I hope this helps

CG
May 21 '07 #4
cgrider
19 New Member
Actually, they want the opposite of this, a case sensitive compare.

Use StrComp(string1, string2, compare) where compare = 0 or vbBinaryCompare. If they match completely it'll return 0

thank you is there a way I can add this to my sql query and if so where would it go or do I have to run this after my original query has run?

CG
May 21 '07 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Now that I think about it, StrComp won't work. I don't see a way to implement it. I also tried looking for a global setting you can use but I came up empty there as well. Google search didn't come up with anything either.

The only thing I can think of now is to write a procedure to recode the string as ASCII values.
May 21 '07 #6
NeoPa
32,556 Recognized Expert Moderator MVP
Are you saying that
Expand|Select|Wrap|Line Numbers
  1. WHERE [Field] = 'M'
also finds records where [Field] = 'm'?
May 22 '07 #7
JConsulting
603 Recognized Expert Contributor
Now that I think about it, StrComp won't work. I don't see a way to implement it. I also tried looking for a global setting you can use but I came up empty there as well. Google search didn't come up with anything either.

The only thing I can think of now is to write a procedure to recode the string as ASCII values.
like this?

Expand|Select|Wrap|Line Numbers
  1. Function fGetASCII(varText) As String
  2.  
  3.     Dim varTemp
  4.     Dim intLoop As Integer
  5.     Dim intTemp As Integer
  6.  
  7.     Const cDelim = "."
  8.  
  9.     If IsNull(varText) Then
  10.         Exit Function
  11.     End If
  12.  
  13.     varTemp = StrConv(varText, 64)
  14.     For intLoop = 1 To Len(varTemp)
  15.         intTemp = Asc(Mid(varTemp, intLoop, 1))
  16.         If intTemp > 0 Then
  17.             fGetASCII = fGetASCII & cDelim & intTemp
  18.             intTemp = 0
  19.         End If
  20.     Next
  21.  
  22.     fGetASCII = Mid(fGetASCII, 2)
  23.  
  24. End Function
  25.  
May 22 '07 #8
Rabbit
12,516 Recognized Expert Moderator MVP
like this?

Expand|Select|Wrap|Line Numbers
  1. Function fGetASCII(varText) As String
  2.  
  3.     Dim varTemp
  4.     Dim intLoop As Integer
  5.     Dim intTemp As Integer
  6.  
  7.     Const cDelim = "."
  8.  
  9.     If IsNull(varText) Then
  10.         Exit Function
  11.     End If
  12.  
  13.     varTemp = StrConv(varText, 64)
  14.     For intLoop = 1 To Len(varTemp)
  15.         intTemp = Asc(Mid(varTemp, intLoop, 1))
  16.         If intTemp > 0 Then
  17.             fGetASCII = fGetASCII & cDelim & intTemp
  18.             intTemp = 0
  19.         End If
  20.     Next
  21.  
  22.     fGetASCII = Mid(fGetASCII, 2)
  23.  
  24. End Function
  25.  
Yeah, something like that. I haven't tried it but why do you use Mid at the bottom?
May 22 '07 #9
JConsulting
603 Recognized Expert Contributor
Yeah, something like that. I haven't tried it but why do you use Mid at the bottom?
Rabbit,
it was used as part of a solution to join two tables...I forgot to take it out.
J
May 23 '07 #10
NeoPa
32,556 Recognized Expert Moderator MVP
Nice work J.
I see we're keeping you busy :) I hope you're enjoying things here.
May 23 '07 #11
JConsulting
603 Recognized Expert Contributor
Nice work J.
I see we're keeping you busy :) I hope you're enjoying things here.
Thanks Neo,
I am having fun..pitching in where I can :o)
J
May 24 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3200
by: Giloosh | last post by:
Hello, i need some help if possible... i have a payments table with over 500 records i want to run a query that searches through the table spotting out any duplicate ID#'s and Dates. So basically...
1
4487
by: Rado | last post by:
Hi All, This might quite simple process for some but I am finding it really difficult to do. What is required is not a standard Duplicate query but a variation on it. For example I have...
1
4318
by: Robert | last post by:
How can I query an existing table and update a field in each record in the table with the occurrence count of each record e.g. update field to 1 (= first record occurrence), update field to 2 for...
2
4975
by: ms | last post by:
Access 2000: I am trying to delete duplicate records imported to a staging table leaving one of the duplicates to be imported into the live table. A unique record is based on a composite key of 3...
2
4068
by: Ross | last post by:
i have less hair now than i used to...i have a database with many duplicate records in it with only one exception, there is one field with the date it was put in the database and that is different....
6
8144
by: sara | last post by:
I have a procedure to automate bringing several Excel files into our Access tables, on a daily basis. The problem is that if the user has a problem, and tries to run the import again (maybe 3...
1
448
by: JG | last post by:
I have an Access 2000 database with a query in it that is pulling data from a table that has duplicate records in it. It is doubling my currency out put. To get rid of the duplicate records in the...
2
2044
by: nethravathy | last post by:
Hi, The following table namely elcbtripselect contains 5147 records.I want to know wether this table contains duplicate records or not. I tried with following query 1)SELECT...
1
2880
by: colin-whitehead | last post by:
I have 2 tables tblReports primary key UPN, plus numeric fields Effort, Attain, etc tblComments numeric primary key ID & textfield Text In the Query I select each record from tblReports...
1
7239
by: xraive | last post by:
I have a problem with this. Currently I am trying Allen's code and i am not successful. Current Design Table1 (Main Form) TravelID (PK) ApprovedBY EntreredBy BudgetCode ExpenseCode
0
7121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7197
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6881
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.