Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 539
  • Last Modified:

Extract part of information from a text field on Access 2003 form

I have a field on a form (text1)that displays the complete smtp email address for a cell phone.I am using  a command button on click event to try to extract the actual phone number up to the “at” sign and place it in text2 . Is this doable?

Text1= 3345552654@vtext.com
Text2=3345552654
0
mickeyshelley1
Asked:
mickeyshelley1
  • 6
  • 4
  • 3
  • +2
1 Solution
 
jerryb30Commented:
me.text2 = left(me.text1, instr(me.text1, "@")-1)
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Val("3345552654@vtext.com")

 returns 3345552654

mx
0
 
Kelvin SparksCommented:
Use a function such as
Left(me.Text1,Instr(1,Me.text1,"@")-1) in a query or VBA to return the number

Kelvin
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
Dale FyeCommented:
you could set the control source of text2 to:

=Left([Text1], instr([Text1] & "@", "@")-1)

If there is no @ symbol in the [Text1] it will return the entire string
0
 
Dale FyeCommented:
Joe,

I keep forgetting about that option.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Val() ... too simple !
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Private Sub btnSomeButtonName_Click()
    Dim x
    x =  Val(Me.YourTextBoxName)
 End Sub
0
 
mickeyshelley1Author Commented:
Thanks this works great...
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
:-)

Let's see.  Two functions vs one ... hummm.

valCapture1.gif
0
 
mickeyshelley1Author Commented:
“Every man is my superior in that I may learn from him.”


¿ Thomas Carlyle
0
 
mickeyshelley1Author Commented:
I apologize for not evaluating post by DatabaseMX on 2013-01-28 at 18:37:02ID: 38827929 after trying this approach it did work equally as well with less clutter. It's simplicity caused me me to overlook it fearing I didn't completely understand it. I will not make this mistake again.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
:-(

" It's simplicity caused me me to overlook it fearing I didn't completely understand it"
Really ?  In general, Less is always More ...
0
 
mickeyshelley1Author Commented:
lol i understand, i requested that the moderator review my awarding of points, you have provided me with sound advice over the years, i acted in haste...
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
no worries ...
0
 
jerryb30Commented:
Here lies Lester Moore
Shot dead by a .44
No les
No more
0
 
Dale FyeCommented:
Redistribute away!  I was wondering why you selected mine, after MX posted his elegant solution.  For some reason, I always forget about that option.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 6
  • 4
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now