Forum Discussion
SheriO7043
Mar 20, 2024Copper Contributor
Access Query Expressions not working: Replace, InStr
I am trying to run a relatively simple query and receive a compile error. The two fields involved are both text fields. SELECT Spouse, Replace(Spouse, Last, "") AS Result FROM SimplifiedTable...
Tom_van_Stiphout
Mar 20, 2024Steel Contributor
Works fine for me. This is using Northwind 2 Dev Edition template. Does this work for you as well?
I added a "Last" field to the Companies table, and populated all rows with "Co".
SELECT Companies.CompanyName, Companies.Last, Replace([CompanyName],[Last],"") AS x
FROM Companies;
CompanyName Last x
Adatum Corporation test Co Adatum rporation test
Adventure Works Cycles Co Adventure Works Cycles
Best For You Organics Company Co Best For You Organics mpany
Contoso, Inc. Co ntoso, Inc.
Woodgrove Bank Co Woodgrove Bank
Wide World Importers Co Wide World Importers
Tailwind Traders Co Tailwind Traders
Proseware, Inc. Co Proseware, Inc.
Green Shipping Co Co Green Shipping
Blue Shipping Co Co Blue Shipping
Yellow Vendor Co Co Yellow Vendor
Brown Vendor Co Co Brown Vendor
Northwind Traders Co Northwind Traders
New company added after link to Excel Co New mpany added after link to Excel
SheriO7043
Mar 20, 2024Copper Contributor
Thank you. I have only tried the query against my database. I'll try creating a new database -- maybe this one (I adopted) is corrupt somehow... I'll get back to you.
- SheriO7043Mar 20, 2024Copper ContributorIt looks like its the database that's bad, not expressions. Thank you so much for the nudge! 🙂