A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Return Left Portion of a String



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2004, 01:46 PM
Bonnie
external usenet poster
 
Posts: n/a
Default Return Left Portion of a String

Returning the left portion of a string in a query.

i.e. if the string is: "

What combination of functions would return only "anybody"
or any number of characters on the left side of the string
before the @ character?

  #2  
Old June 1st, 2004, 02:06 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default Return Left Portion of a String

"Bonnie" wrote in message
...
Returning the left portion of a string in a query.

i.e. if the string is: "

What combination of functions would return only "anybody"
or any number of characters on the left side of the string
before the @ character?


Left([YourField], InStr(1, [YourField], "@") - 1)


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



  #3  
Old June 1st, 2004, 02:12 PM
Newbie
external usenet poster
 
Posts: n/a
Default Return Left Portion of a String

Try something like . . . not tested

Sub GETSTRING()
TempStr = ""

MyString = Trim(Forms!form1!txtBox1.Value)

For i = 1 To (Len(MyString))
If Mid(MyString, i, 1) = "@" Then
TempStr = TempStr & Mid(MyString, i, 1)

End If
Next
End sub


HTH
"Bonnie" wrote in message
...
Returning the left portion of a string in a query.

i.e. if the string is: "

What combination of functions would return only "anybody"
or any number of characters on the left side of the string
before the @ character?



  #4  
Old June 1st, 2004, 02:23 PM
Newbie
external usenet poster
 
Posts: n/a
Default Return Left Portion of a String

Ignore the last post!

Try this instead

Sub GETSTRING2()

MyString = "

TempStr = Left$(MyString, (InStr(1, MyString, "@", 0) - 1))
Debug.Print TempStr
End Sub

HTH
"Newbie" wrote in message
...
Try something like . . . not tested

Sub GETSTRING()
TempStr = ""

MyString = Trim(Forms!form1!txtBox1.Value)

For i = 1 To (Len(MyString))
If Mid(MyString, i, 1) = "@" Then
TempStr = TempStr & Mid(MyString, i, 1)

End If
Next
End sub


HTH
"Bonnie" wrote in message
...
Returning the left portion of a string in a query.

i.e. if the string is: "

What combination of functions would return only "anybody"
or any number of characters on the left side of the string
before the @ character?





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:37 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.