Text on second line of Text Box

  • Thread starter Thread starter SurveyorinVA via AccessMonster.com
  • Start date Start date
S

SurveyorinVA via AccessMonster.com

Good afternoon:

I have a large text box that the user can use <cntrl> <enter> to do a
carriage return and enter more data on the second line of this box. If I
want to split this data entered into two string values, what would be the
proper way to get the txtLine01 to equal the data on the first line and
txtLine02 to equal the data on the second line of text?

Any help would be greatly appreciated.
Thanks,
CF
 
My first thought is to use the Instr() function to look for the carrigae
return, and then split the string that way, but I'm sure that there might be
a better way - like using the split function directly instead. Or maybe a
combination in that you would want to test for the character before splitting
the string...

And because you haven't said when you would do this, I can't say which event
is the right place to put the code...

HTH,

Corey
 
Thanks for the info....
Basically the user will be typing in an address... 1st line Street No and
Street Name, 2nd Line: City, State and/Zip Code


I would like to collect line one as txtString1 and line 2 as txtString2. I
will then update my recordset based on other criteria and save txtString1 and
txtString2 to Address01 and Address02 in my record.

Thanks,
CF
 
Thanks for the info....
Basically the user will be typing in an address... 1st line Street No and
Street Name, 2nd Line: City, State and/Zip Code

I would like to collect line one as txtString1 and line 2 as txtString2. I
will then update my recordset based on other criteria and save txtString1 and
txtString2 to Address01 and Address02 in my record.

Thanks,
CF

Line1 = Left([FullText],InStr([FullText],che(13) & chr(10))-1)

Line 2 = Mid([FullText],InStr([FullText],chr(13) & chr(10))+2)

Wouldn't it be better to tell the user NOT to enter both addresses in
the control?
 
txtString1 = Left(Me.WholeAddress, (InStr(Me.WholeAddress, Chr(13))) - 1)
txtString2 = Right(Me.WholeAddress, Len(WholeAddress) - (InStr(Me.
WholeAddress, Chr(13))))

The txtString2 line all needs to be on one line (it'll be on two lines in
this post)
Thanks for the info....
Basically the user will be typing in an address... 1st line Street No and
Street Name, 2nd Line: City, State and/Zip Code

I would like to collect line one as txtString1 and line 2 as txtString2. I
will then update my recordset based on other criteria and save txtString1 and
txtString2 to Address01 and Address02 in my record.

Thanks,
CF
My first thought is to use the Instr() function to look for the carrigae
return, and then split the string that way, but I'm sure that there might be
[quoted text clipped - 8 lines]

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
SurveyorinVA said:
I have a large text box that the user can use <cntrl> <enter> to do a
carriage return and enter more data on the second line of this box. If I
want to split this data entered into two string values, what would be the
proper way to get the txtLine01 to equal the data on the first line and
txtLine02 to equal the data on the second line of text?

Dim varParts As Variant
varParts = Split(largetextbox, Chr(13) & Chr(10))
txtLine01 = varParts (0)
txtLine02 = varParts (1)

or

Dim pos As Long
pos = InStr(largetextbox, Chr(13) & Chr(10))
txtLine01 = Left(largetextbox, pos - 1)
txtLine02 = Mid(largetextbox,pos + 2)
 
Back
Top