472,961 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,961 software developers and data experts.

Access Query Criteria - working with a Domain "\" user list.

MitchR
65 64KB
Howdy Folks!

I am working on a project where I have been given Domain\Usernames (Contoso\JSmith) and my data dump has records containing the Domain\ and no user name, Domain\administrator, and Bogus Domains that I need to remove with delete queries. I am looking to isolate both the left and right of the "\" to remove garbage items, but I need some assistance in doing so. I have attempted to use the following:
Expand|Select|Wrap|Line Numbers
  1. Right([tbl_users].[user_list_Column],InStr([tbl_users].[user_list_Column],'\'))>"" 
Expand|Select|Wrap|Line Numbers
  1. Left([US_Local_Admin],InStr([US_Local_Admin],'\')-1) <>"Contoso"
I know I am going nowhere fast and need some assistance.
Jan 27 '21 #1

✓ answered by NeoPa

Hi Mitch.

It can be done all in one go but it's easier to define two (calculated) Fields first then reference them in your logic :
Expand|Select|Wrap|Line Numbers
  1. Domain: IIf([tbl_users].[user_list_Column] Is Null,Null,Left([tbl_users].[user_list_Column],InStr([tbl_users].[user_list_Column],'\')-1))
  2. UserName: IIf([tbl_users].[user_list_Column] Is Null,Null,Mid([tbl_users].[user_list_Column],InStr([tbl_users].[user_list_Column],'\')+1,999))
  3. Check: ([Domain]<>'Contoso')
Etc.

3 1715
NeoPa
32,547 Expert Mod 16PB
Hi Mitch.

It can be done all in one go but it's easier to define two (calculated) Fields first then reference them in your logic :
Expand|Select|Wrap|Line Numbers
  1. Domain: IIf([tbl_users].[user_list_Column] Is Null,Null,Left([tbl_users].[user_list_Column],InStr([tbl_users].[user_list_Column],'\')-1))
  2. UserName: IIf([tbl_users].[user_list_Column] Is Null,Null,Mid([tbl_users].[user_list_Column],InStr([tbl_users].[user_list_Column],'\')+1,999))
  3. Check: ([Domain]<>'Contoso')
Etc.
Jan 28 '21 #2
MitchR
65 64KB
Thank you so much! I really appreciate your insight, and you are so right!
Jan 29 '21 #3
NeoPa
32,547 Expert Mod 16PB
Always a pleasure :-)
Jan 30 '21 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: jen | last post by:
What is the correct syntax to reference a form field in a query. For example, I want to pull data where field x of my table equals field y on a form? Thanks in advance for the help!
2
by: mgolding | last post by:
I have an Access query that gets an ID value from an open form. Something like SELECT * from tablename WHERE ID=openFormName.ID; But now, I want to also run the query by handing it the ID from...
3
by: PCCTN | last post by:
I am trying to find out what criteria to put into a specific query that is connnected to a table field of part numbers. The problem is that it has some part numbers that are numbers and some part...
3
by: heckstein | last post by:
I have created a query in MS Access 2003 that is pulling training records for our company that includes training hour calculation. One field I am pulling is the instructor name. Many courses have...
3
by: marylipscomb | last post by:
I am going over code that I am now responsible for but did not write. Can someone tell me what this means? Thank you so much Also this is on a query, criteria. Like "*" & !! & "*" What does...
2
by: Aussie Rules | last post by:
Hi, I have a access 2007 database with a cross tab query. Based on the selection critieria the cross tab may contain a different number columns in the result. For example if the query is...
9
ajhayes
by: ajhayes | last post by:
Hello everyone, This is my first time posting here and I'm hoping someone can help me out. I'm a relative newbie to Access and am pretty much learning as I go along, so please bear with me. ...
5
by: erog | last post by:
Hello I've tried using the MS Access Northwind sample DB and I've downloaded a few other sample Microsoft Access DBs from their website. I keep on running into the same problem for trying to...
1
by: JMacdonald | last post by:
I have a datasheet with a column called 'Primary Category' which has a drop-down menu so the user can select from a number of different categories. I am trying to create a query which uses one...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.