Case Sensitive Joints in Access

ankita.sethi

Board Regular
Joined
Apr 27, 2011
Messages
58
Hi,

I have two tables in Access and both have a primarykey with unique values called 'ID'.
But this field has unique values only if you consider case sensitivity. For eg, it might have both 'aa' and 'AA' as values in it. My data is such that I want to consider these as different values (aa <> AA)

So my basic problem is to put a joint on these 2 tables that somehow recognizes case of the text.

Any ideas??
 

Kyle123

Well-known Member
Joined
Jan 24, 2012
Messages
2,684
If they are the same characters but a different case then they aren't unique and it's one of the reasons you never use anything meaningful as a primary key - it should either be numeric or a GUID, nothing else.

The only thing that I could think of would be to run a replace on the char codes and join on the result, but I image that it would perform horrendously, most databases are not case sensitive
 

xenou

MrExcel MVP, Moderator
Joined
Mar 2, 2007
Messages
16,551
Office Version
2013
Platform
Windows
I think that's right. You could use the ascii values, - quite ugly but at least feasible. I'd probably write a function to convert the value to an alpha-numeric hybrid (or more specifically to populate another field that can be used for the purpose of the join, so as not to destroy the original value). Databases generally are not case sensitive so that's not the way to create a key if you can avoid it.

Example:
065065 for AA (ascii value 65)
097097 for aa (ascii value 97)

Or:
A65A65 for AA
a97a97 for aa

if the table is not large you could probably use your function on the fly to match the tables without having an actual extra column, but I think this would be bad performance on a very large table.
 

Forum statistics

Threads
1,081,517
Messages
5,359,234
Members
400,523
Latest member
ExcelNewbie98

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top