kevinh2320
Board Regular
- Joined
- May 13, 2016
- Messages
- 61
I have a column in one of my Access queries called CustomerName_DBAName. Below is an example of what that data typically looks like.
CustomerName_DBAName
JOHN T. PUBLIC
JAKE A. SMITH JR.
ABC COMPANY
STEVE JONES - DBA: SUPER STORE
BIG COMMUNICATIONS, LLC
SOME BUSINESS INC.
JOE SLOW - DBA: QUICK DELIVERY
I've added two new columns to my query called CustName and Business name. I need to help with expressions to separate the CustomerName part of the CustomerName_DBAName and the DBAName part of the from the DBAName part of CustomerName_DBAName column and put that data in their respective new columns.
I tried this expression "CustName: Left([CustomerName_DBAName],InStr(1,[CustomerName_DBAName],"-")-1)" for the CustName column. It returns the customer name for those entries that contain a hyphen. But, I only get a "#func!" error for those without a hyphen.
Any help would be greatly appreciated.
The end result should look like this:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]CustomerName_DBAName[/TD]
[TD]CustName[/TD]
[TD]BusinessName[/TD]
[/TR]
[TR]
[TD]JOHN T. PUBLIC[/TD]
[TD]JOHN T. PUBLIC[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JAKE A. SMITH JR.[/TD]
[TD]JAKE A. SMITH JR.[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC COMPANY[/TD]
[TD]ABC COMPANY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]STEVE JONES - DBA: SUPER STORE[/TD]
[TD]STEVE JONES[/TD]
[TD]SUPER STORE[/TD]
[/TR]
[TR]
[TD]BIG COMMUNICATIONS, LLC[/TD]
[TD]BIG COMMUNICATIONS, LLC[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SOME BUSINESS INC.[/TD]
[TD]SOME BUSINESS INC.[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JOE SLOW - DBA: QUICK DELIVERY[/TD]
[TD]JOE SLOW[/TD]
[TD]QUICK DELIVERY[/TD]
[/TR]
</tbody>[/TABLE]
CustomerName_DBAName
JOHN T. PUBLIC
JAKE A. SMITH JR.
ABC COMPANY
STEVE JONES - DBA: SUPER STORE
BIG COMMUNICATIONS, LLC
SOME BUSINESS INC.
JOE SLOW - DBA: QUICK DELIVERY
I've added two new columns to my query called CustName and Business name. I need to help with expressions to separate the CustomerName part of the CustomerName_DBAName and the DBAName part of the from the DBAName part of CustomerName_DBAName column and put that data in their respective new columns.
I tried this expression "CustName: Left([CustomerName_DBAName],InStr(1,[CustomerName_DBAName],"-")-1)" for the CustName column. It returns the customer name for those entries that contain a hyphen. But, I only get a "#func!" error for those without a hyphen.
Any help would be greatly appreciated.
The end result should look like this:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]CustomerName_DBAName[/TD]
[TD]CustName[/TD]
[TD]BusinessName[/TD]
[/TR]
[TR]
[TD]JOHN T. PUBLIC[/TD]
[TD]JOHN T. PUBLIC[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JAKE A. SMITH JR.[/TD]
[TD]JAKE A. SMITH JR.[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC COMPANY[/TD]
[TD]ABC COMPANY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]STEVE JONES - DBA: SUPER STORE[/TD]
[TD]STEVE JONES[/TD]
[TD]SUPER STORE[/TD]
[/TR]
[TR]
[TD]BIG COMMUNICATIONS, LLC[/TD]
[TD]BIG COMMUNICATIONS, LLC[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]SOME BUSINESS INC.[/TD]
[TD]SOME BUSINESS INC.[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JOE SLOW - DBA: QUICK DELIVERY[/TD]
[TD]JOE SLOW[/TD]
[TD]QUICK DELIVERY[/TD]
[/TR]
</tbody>[/TABLE]