A query to discover the number

DRANDON

Active Member
Joined
Jun 30, 2006
Messages
268
All, I am in Access and need a way in a query discover if all of my 5 characters are text, then delete the record. I could have values such as "E3MTH" or "DOS6P", but if my query comes across a value that is like "DTHRS" delete the record. I was thinking something like

iif(and(Not Numeric(Mid([CPT],1),Not Numeric(Mid([CPT],2),Not Numeric(Mid([CPT],3),Not Numeric(Mid([CPT],4),Not Numeric(Mid([CPT],5))

I will be trying this out in Access tomorrow but I thought I would throw this out to my favorite forum for ideas. Thanks so much in advance.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
You could use Like perhaps.

UCase([CPT]) Like "[A-Z][A-Z][A-Z][A-Z][A-Z]"
 
Upvote 0
OK as long as you only ever have 5 characters in the field value. Otherwise, you might want to use a sub or function to evaluate each character.
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

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