473,441 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

Pasting multiple lines of data into text box - how do I divide it into seperate strings??

I've got a text box that I want users to paste a list of values into
(from Excel for example). However, breaking this large string down into
its component records is a little harder. I've used left(), mid() etc
but they depend on a set number of characters for each line. I'm
wondering if there is an operator which detects the new line and so
would allow me to icut each line and put it into an array.

Also wonding if there is a setting in text boxs which allows a user to
press 'enter' and go to a new line instead of to the next field.

Cheers

Reg

Dec 7 '05 #1
9 7648
Sorted the new line thing - ctrl enter.... simple I know.

Dec 7 '05 #2
The easiest way to split the input is to use the Split function

Something like:-

Dim varArray as variant
dim intCount as integer

varArray = Split(me.txtInput, vbCrLf)

If IsArray(varArray) then
for intCount = lBound(varArray) to uBound(varArray)
' do stuff with the individual lines
next
end if

--
Terry Kreft

"Regnab" <p.*******@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
I've got a text box that I want users to paste a list of values into
(from Excel for example). However, breaking this large string down into
its component records is a little harder. I've used left(), mid() etc
but they depend on a set number of characters for each line. I'm
wondering if there is an operator which detects the new line and so
would allow me to icut each line and put it into an array.

Also wonding if there is a setting in text boxs which allows a user to
press 'enter' and go to a new line instead of to the next field.

Cheers

Reg

Dec 7 '05 #3
Setting the form control property "Enter Key Behavior" to "New Line In
Field" will cause 'Enter' to go to a new line

"Regnab" <p.*******@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
I've got a text box that I want users to paste a list of values into
(from Excel for example). However, breaking this large string down into
its component records is a little harder. I've used left(), mid() etc
but they depend on a set number of characters for each line. I'm
wondering if there is an operator which detects the new line and so
would allow me to icut each line and put it into an array.

Also wonding if there is a setting in text boxs which allows a user to
press 'enter' and go to a new line instead of to the next field.

Cheers

Reg

Dec 7 '05 #4
"Terry Kreft" <te*********@mps.co.uk> wrote in
news:5q********************@karoo.co.uk:
The easiest way to split the input is to use the Split function

Something like:-

Dim varArray as variant
dim intCount as integer

varArray = Split(me.txtInput, vbCrLf)

If IsArray(varArray) then
for intCount = lBound(varArray) to uBound(varArray)
' do stuff with the individual lines
next
end if


Split() was introduced only with A2K. I think that as long as A97 is
still a mainstream development platform (which it certainly is), one
should mention this with features that were introduced only in later
versions of Access.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Dec 8 '05 #5
Well, for sure; I always keep a bucket of oats and a big shovel for my
friends who come to visit with the horse and buggy.

Dec 8 '05 #6

Well, I think that I could do that, but as it's my time I'm spending
answering the OP I think instead I'll decide how I use it.

So, if the OP states they use A97 I'll tailor the answer to that, if they
don't, and I'm in the mood, I'll answer for all versions. If I'm not in the
mood for that I'll answer for the latest version and wait for them to
respond if it doesn't work.

If I don't feel like it I won't answer at all.
--
Terry Kreft

"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn**********************************@216.196. 97.142...
"Terry Kreft" <te*********@mps.co.uk> wrote in
news:5q********************@karoo.co.uk:
The easiest way to split the input is to use the Split function

Something like:-

Dim varArray as variant
dim intCount as integer

varArray = Split(me.txtInput, vbCrLf)

If IsArray(varArray) then
for intCount = lBound(varArray) to uBound(varArray)
' do stuff with the individual lines
next
end if


Split() was introduced only with A2K. I think that as long as A97 is
still a mainstream development platform (which it certainly is), one
should mention this with features that were introduced only in later
versions of Access.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

Dec 8 '05 #7
Well let me just say that I'm very glad you were in the mood (very
helpful for me), I'm using Access 2003, and I thoroughly enjoyed the
verbal sparring....

Dec 8 '05 #8
Your code works a treat. Brilliant. Thanks Terry.... you tailored it
rather nicely....

Dec 8 '05 #9
Terry Kreft wrote:
The easiest way to split the input is to use the Split function

Something like:-

Dim varArray as variant
dim intCount as integer

varArray = Split(me.txtInput, vbCrLf)

If IsArray(varArray) then
for intCount = lBound(varArray) to uBound(varArray)
' do stuff with the individual lines
next
end if


I hadn't heard of split. Thanks for bringing it to Regnab's and my
attention, though I wish I'd known about it previously... good heavens,
would have saved me a large amount of time I spent recently some parsing
procs!!! 8)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Dec 8 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeremy | last post by:
I have a pretty straightforward database that is designed to record free-form information about products (date, source and a memo field). This is searched and updated via a form. For new records,...
4
by: John Doe | last post by:
I am interested in creating a database of my mp3 files. What I am looking to do is paste a series of lines of text into a series of table cells in access. Every time I try to do it, it pastes ALL...
2
by: Ed_P. | last post by:
Hello, Up to this point, I've been using C# to create simple applications that only use on Project to store Windows Forms and other Files. The project has been complied into an EXE. The exe file...
21
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
9
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
3
by: Bobby | last post by:
Hi, I have an application which uses Access 2003 as both the FE and the BE. However, for a number of good reasons, I am in the process of converting the BE to SQL server 2003. I am not converting...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.