Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2013-01-28
17
524 Views
Last Modified: 2013-02-08
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
Comment
Question by:mickeyshelley1
  • 6
  • 4
  • 3
  • +2
17 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 38827859
me.text2 = left(me.text1, instr(me.text1, "@")-1)
0
 
LVL 75
ID: 38827860
Val("3345552654@vtext.com")

 returns 3345552654

mx
0
 
LVL 22

Expert Comment

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

Kelvin
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38827883
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
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38827894
Joe,

I keep forgetting about that option.
0
 
LVL 75
ID: 38827910
Val() ... too simple !
0
 
LVL 75
ID: 38827929
Private Sub btnSomeButtonName_Click()
    Dim x
    x =  Val(Me.YourTextBoxName)
 End Sub
0
 

Author Comment

by:mickeyshelley1
ID: 38828226
Thanks this works great...
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 38828250
:-)

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

valCapture1.gif
0
 

Author Comment

by:mickeyshelley1
ID: 38828294
“Every man is my superior in that I may learn from him.”


¿ Thomas Carlyle
0
 

Author Comment

by:mickeyshelley1
ID: 38828359
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
 
LVL 75
ID: 38828368
:-(

" It's simplicity caused me me to overlook it fearing I didn't completely understand it"
Really ?  In general, Less is always More ...
0
 

Author Comment

by:mickeyshelley1
ID: 38828392
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
 
LVL 75
ID: 38828413
no worries ...
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38828623
Here lies Lester Moore
Shot dead by a .44
No les
No more
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38828994
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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question