473,320 Members | 1,940 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,320 software developers and data experts.

Reading comma seperated lists

Hi, I've got a field that contains a list of rooms.

In most cases, this contains a single ID. However, under some
circumstances, the field may contain a list of two IDs which
are broken by a comma.

For example: BENL LT, RAT LT

At the moment, I've got the VBA bits working on the single
ID stuff, but, should it come across a list like the above,
I want it to parse both entries as two different entities.

How would I go about getting it to do this?

Hope that makes sense,

:-)

Gary
Nov 13 '05 #1
3 1620
On 2004-09-05, Gary Smith <sh******@l33t-d00d.co.uk> wrote:
Hi, I've got a field that contains a list of rooms.

In most cases, this contains a single ID. However, under some
circumstances, the field may contain a list of two IDs which
are broken by a comma.

For example: BENL LT, RAT LT


Hmm, that was a really bad explanation of what I wanted to do. Sorry.

Let me clarify.

I've got a few tables, one of which is imported data. In this table,
is one field containing a list of rooms - usually, this contains a single
room. However, there's a few instances where this will contain two,
in the above form (ie "BENL LT, RAT LT"). There's a Form that goes
through this imported data and does Stuff[tm] to it with a script.

One of these things is it cross references these rooms against another
table in the database. However, when it comes across these rooms (ie a
comma seperated list, it doesn't recognise it, although the two on their
own are valid. How can I get the script to recognise these are two
distinct entities, rather than one?

Cheers,

Gary, hoping that makes more sense.
Nov 13 '05 #2
rkc

"Gary Smith" <sh******@l33t-d00d.co.uk> wrote in message
news:sl*********************@profile.l33t-d00d.co.uk...
On 2004-09-05, Gary Smith <sh******@l33t-d00d.co.uk> wrote:
Hi, I've got a field that contains a list of rooms.

In most cases, this contains a single ID. However, under some
circumstances, the field may contain a list of two IDs which
are broken by a comma.

For example: BENL LT, RAT LT


Hmm, that was a really bad explanation of what I wanted to do. Sorry.

Let me clarify.

I've got a few tables, one of which is imported data. In this table,
is one field containing a list of rooms - usually, this contains a single
room. However, there's a few instances where this will contain two,
in the above form (ie "BENL LT, RAT LT"). There's a Form that goes
through this imported data and does Stuff[tm] to it with a script.

One of these things is it cross references these rooms against another
table in the database. However, when it comes across these rooms (ie a
comma seperated list, it doesn't recognise it, although the two on their
own are valid. How can I get the script to recognise these are two
distinct entities, rather than one?


Avoid the problem by splitting the records with multiple values when you
import the data.

or

Have the script check for an occurance of a comma, split the
field and process it as two records. Details of how to do that depend
greatly on the script that does the Stuff. Just splitting the field is
trivial
using Split() if you're post Access 97 or Instr() and Left(), Right(), Mid()
if your at Access 97.

Nov 13 '05 #3
On 2004-09-05, rkc <rk*@yabba.dabba.do.rochester.rr.bomb> wrote:
Have the script check for an occurance of a comma, split the
field and process it as two records. Details of how to do that depend
greatly on the script that does the Stuff. Just splitting the field is
trivial
using Split() if you're post Access 97 or Instr() and Left(), Right(), Mid()
if your at Access 97.


I had a think about this on the train (I was away over the
weekend) and ended up doing voodoo with Left(Instr()) and Right(Instr() in the
end, and stripping out any errant spaces that might've crept in and it seems
to have done the trick.

Cheers :-)

Gary
Nov 13 '05 #4

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

Similar topics

7
by: Craig Keightley | last post by:
is it possible to compare acomma separated list aginst another eg comma list 1 => 1,2,3,4,5 comma list 2 => 3,5 can you check that 3 is in both, and 5 is in both, therfore they match??? the...
2
by: Pmb | last post by:
I'm trying to learn the syntax for initializing objects in a comma separated list. Below is an example program I wrote to learn how to do this (among other things). While I understand how to...
3
by: muzamil | last post by:
To get rid of redundant data in a table, my cleint will be providing something like this: IDtokeep Ids to delete 34 24,35,49 12 14,178,1457 54 32,65,68 I have to write a...
11
by: Shawn Odekirk | last post by:
Some code I have inherited contains a macro like the following: #define setState(state, newstate) \ (state >= newstate) ? \ (fprintf(stderr, "Illegal...
4
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0...
1
by: CJK | last post by:
this is what i have so far: #include <iostream> #include <string> #include <vector> #include <fstream> using namespace std; class Person {
13
by: anant | last post by:
Hi all The below code is reading string and then tokenizin it and reading all the info. But i want to call a csv file and it should then read a string from dt file. So what midification should i...
2
nehashri
by: nehashri | last post by:
i hv a database in access wid Asp as front end. ven given a word in search command(of the front end) it shud go to a table in which each field has words serated by comma. each word shud b checked...
1
by: (2b|!2b)==? | last post by:
I have the following line in my code, which is supposed to skip commas and white space and to read a comma seperated value string into the appropriate variables: sscanf(temp.c_str(),...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.