Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Email Input Mask
David Czerwinski 
    
4 years ago
is it possible to create a custom mask for email address based on the customers first letter of the first name combined together with his last name for a domain called xyz.com in a customer input form  example john Doe = [email protected]. Assuming the domain is static.
Alex Hedley  @Reply  
           
4 years ago
Why not just build it with and AfterUpdate on the first/last name entry?
David Czerwinski OP  @Reply  
    
4 years ago
thanks Alex, I will google AfterUpdate as I'm fairly new to Access. Been using Excel over 20 years and recently converted my DB. I'm assuming there would be some VB in there somewhere also.
Adam Schwanz  @Reply  
           
4 years ago
David Czerwinski OP  @Reply  
    
4 years ago
any chance of help with the code? lets say the fields are fname lname and email so go to afterUpdate and set the event to kick off after the lname is typed and clicked. I need to grab the first character from the fname and the complete Lname and add the "@xyz.com" to the string and input it into email on the form.
Adam Schwanz  @Reply  
           
4 years ago
If Lname="" or Fname = "" Then
'Do Nothing
Else
  email = Left([fname],1) & lname & "@xyz.com"
End If

David Czerwinski OP  @Reply  
    
4 years ago
your the man! that works great on new records. So my next big question is what is the best way to update the existing records to add the email. I tried going through a existing record hitting enter after the lname field but no change what am I missing?
David Czerwinski OP  @Reply  
    
4 years ago
BTW it does work if I mod the record in the form
Adam Schwanz  @Reply  
           
4 years ago
after update fires on change, you can simply add a letter and backspace it then tab to fire it, or if you have a lot of records, probably best to use a recordset for going through everything once and setting them.
Adam Schwanz  @Reply  
           
4 years ago
Actually an update query is going to be a lot simpler for you.
Adam Schwanz  @Reply  
           
4 years ago

Adam Schwanz  @Reply  
           
4 years ago
Update Queries if you want more info :P
Adam Schwanz  @Reply  
           
4 years ago
If you have nulls, might need to bring in fname and lname and set criteria to not isnull
Scott Axton  @Reply  
        
4 years ago
OK playing devils advocate here.  Things to consider.

You probably don't want this to fire every time you make a change.  I would only make the email in the event that the email field is blank.  
If email <> "" then Exit Sub  
I can't imagine you want  emails changing all the time.

Before you go creating that email I would put a check in place to see if it already exists.  What would happen if you have a Jim Smith employed then you hire on Joan Smith? Who gets the [email protected] email?

What happens to Debbie Peterson's emails when she gets married and her name changes to Debbie Jones? Does the email change? Keep her old one?

This seems easy and straight forward on the face of it but you should plan ahead.
Adam Schwanz  @Reply  
           
4 years ago
Good points Scott, you could make it complex and DLOOKUP the email before it assigns it to make sure it doesn't exist, and if it does, to add a number to the end, but then you have to check for [email protected] etc. too :P it gets fun quick. You can do it, but you need to decide how you want to handle it first.
Richard Rost  @Reply  
          
4 years ago
Yeah, input masks are not good for email addresses. Go with what the guys are suggesting.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/2/2026 8:49:33 AM. PLT: 0s