Left() like in excel

funkykayli

Board Regular
Joined
Apr 25, 2007
Messages
183
I have a query in which I want to find duplicates. I can not use the duplicate query because:

I have a list of claim numbers. Here is an example of duplicates I need to identify:
12345A
12345B
12345C
So the duplicate query won't work because they are actually different. Is there a way to look at just the first 5 characters for duplicates?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You are on that right track.

One way is to create an "intermedidate query", which use the LEFT function to take the first five characters of your field. Then use that query in a new query to find the duplicates (can be done using an Aggregate Query).
 
Upvote 0
I'm sorry but what do you mean by an intermediate query? Is that just a separate query to use the left function? Also, where would I put the left function? Do I put that in the sql statement? Sorry for all the questions but I am a newbie with Access.
 
Upvote 0
Ok, I think I figured it out. I was putting the expression in the criteria instead of the field.

Thank you!!!!!!!
 
Upvote 0
Ok, I got the left expression to work in a query. Now when I go to run a duplicate query on the field I created with the left expression I get an error message...

"You tried to executre a query that does not include the specified expression 'count(*)>1 And Left([CLM_ID],13)=' as part of an aggregate function."

I do not understand this error message. Is there a way around it?
 
Upvote 0
That is why I was recommedning an intermediate query. Access gets very tempermental when you try to do aggregate queryies on fields calcaulted in the same query.

So, create a Query "A", that does your calculations
Then, create a second Query "B", which uses the Query "A" as its control source and does the Aggreagte Query (duplicates).
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,607
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top