Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a field have consistent data

Status
Not open for further replies.

cer5yc

Programmer
Sep 27, 2007
103
0
0
US
I have a field in a table for Email Addresses. My problem is the domain names are old. I need to make everything after the @ sign read "@aol.com" and make all the email addresses lower case. Right now there are various domain names and they all need to be consistent.

My table name is "HRFeed". The column name is "Email".

Can someone tell me how to do this?

Thanks!!
 
You can use StrConv, Mid and Instr functions to do this.
 
So for example, if your data is: John_Doe@earthlink.net in a field called Address1, then in a query you can do this:

new_email: Left([Address1],InStr([Address1],"@")-1) & "@aol.com"



-----------------------------------------
Never, ever approach a computer saying, or even thinking, "I will just do this quickly."
 
THANK YOU SO MUCH! That worked wonders. Do you happen to know how I can make all the addresses lower case? Some of them are in the file as JOHNS1@aol.com and I need it to read johns1@aol.com
 
How are ya cer5yc . . .

[blue]webcats[/blue] is on target (just didn't plugin the names). However to stomp on all the addresses, perform the following:

Open a new query. Goto [blue]SQL view[/blue] and paste the following (overwrite Select:):
Code:
[blue]UPDATE HRFeed SET HRFeed.Email = StrConv(Left([Email],InStr(1,[Email],"@")) & "aol.com",2);[/blue]
Save & name the query, then run it! . . .

thats it! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Thanks so much - that worked like a charm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top