Solved

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

Posted on 2013-01-28
17
517 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
Comment Utility
me.text2 = left(me.text1, instr(me.text1, "@")-1)
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Val("3345552654@vtext.com")

 returns 3345552654

mx
0
 
LVL 22

Expert Comment

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

Kelvin
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
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)
Comment Utility
Joe,

I keep forgetting about that option.
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Val() ... too simple !
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Private Sub btnSomeButtonName_Click()
    Dim x
    x =  Val(Me.YourTextBoxName)
 End Sub
0
 

Author Comment

by:mickeyshelley1
Comment Utility
Thanks this works great...
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
Comment Utility
:-)

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

valCapture1.gif
0
 

Author Comment

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


¿ Thomas Carlyle
0
 

Author Comment

by:mickeyshelley1
Comment Utility
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

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
:-(

" 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
Comment Utility
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

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
no worries ...
0
 
LVL 26

Expert Comment

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

Expert Comment

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Access query grid query 10 19
How calculate median 5 37
How count number of unique values at end of report 5 28
Max per month 3 13
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now