Ask a Question related to ASP Database, Design and Development.
-
Darren #1
Seperating data within a field
Hi All,
I am designing a website for a tennis club. Each week Tennis Australia
release an excel spreadsheet of last weekend's results. I import this
into my access DB for use on the website.
"The problem"
The first coloumn of the spreadsheet is the clubname and division. I
need to seperate the two.
At the moment when I import the data I get this
tablename:
tblResults
fieldname:
ClubAndDivision
records:
Mellor Park Div1
Henley Beach Div1
West Lakes Div2
Mellor Park Div2
Henley Beach Div4
What I would like is this instead
tablename:
tblResults
fieldnames:
Club Division
records:
Mellor Park Div1 (or just the number)
Henley Beach Div1
West Lakes Div2
Mellor Park Div2
Henley Beach Div4
I've tried to find a solution using a query but I'm not that good at
access yet. I've even asked Tennis Australia to change their
spreadsheet but they said no. Any ideas?
Thanks in advance,
Darren Stahlhut
Darren Guest
-
Comparing current field data with last entry for field
Hi. I have a form that is inserting sales data on a daily basis. I have a field named "RoundTOTAL" which is the total sales for the day rounded to... -
Spotcolour in a DCS is seperating addional on other Spotplates
Hello, thought to me is nothing strange anymore ; -) and did not had ever problems with spots out of Photoshop, however created with plug-ins in PSD... -
seperating filenames
Hi, I'm using the input File method for users to upload their files to a folder on a website, I wanted to store the filename in the database but... -
Seperating data from single table field (string)
Hi All Can anyone help with this please. I need a way of putting say 10 to 20 bullet points in one table field in an Access database - say... -
seperating ascx and cs files
Hi, By default, code behind files (*.cs) and *.aspx files are located in the same folder. I want to separate my code behind files to a different... -
Maarten #2
Re: Seperating data within a field
Why not importing the whole text in the first field
After importing you select the record with a blank second field
DO WHILE NOT RS.eof
vTxt = Trim(RS("firstField"))
For x = len(vTxt) to 1 step-1
If Mid(vTxt, x, 1) = " " then
part1 = trim(left(vTxt,x-1))
part2 = trim(right(vTxt, len(vTxt)-x))
end if
set instruction RS("firstField") = part1
set instruction RS("secondField") = part2
RS.MoveNext
Loop
"Darren" <darrenstahlhut@hotmail.com> schreef in bericht
news:898d00a0.0404010241.5e1652bb@posting.google.c om...> Hi All,
>
> I am designing a website for a tennis club. Each week Tennis Australia
> release an excel spreadsheet of last weekend's results. I import this
> into my access DB for use on the website.
>
> "The problem"
> The first coloumn of the spreadsheet is the clubname and division. I
> need to seperate the two.
>
> At the moment when I import the data I get this
>
> tablename:
> tblResults
>
> fieldname:
> ClubAndDivision
>
> records:
> Mellor Park Div1
> Henley Beach Div1
> West Lakes Div2
> Mellor Park Div2
> Henley Beach Div4
>
> What I would like is this instead
>
> tablename:
> tblResults
>
> fieldnames:
> Club Division
>
> records:
> Mellor Park Div1 (or just the number)
> Henley Beach Div1
> West Lakes Div2
> Mellor Park Div2
> Henley Beach Div4
>
> I've tried to find a solution using a query but I'm not that good at
> access yet. I've even asked Tennis Australia to change their
> spreadsheet but they said no. Any ideas?
>
> Thanks in advance,
> Darren Stahlhut
Maarten Guest
-
Maarten #3
Re: Seperating data within a field
You can also seek for DIV
p=Instr(text," div")
part1 = left(text,p-1)
etc...
Maarten Guest
-
Bob Barrows #4
Re: Seperating data within a field
Darren wrote:
It is definitely a good idea to separate them, especially if you have a need> Hi All,
>
> I am designing a website for a tennis club. Each week Tennis Australia
> release an excel spreadsheet of last weekend's results. I import this
> into my access DB for use on the website.
>
> "The problem"
> The first coloumn of the spreadsheet is the clubname and division. I
> need to seperate the two.
>
to select or sort records by division.
So the first step is to initially import the data into a work table, instead
of directly into tblResults. Then use this query to insert the records into
the tblResults table (which I am assuming will already exist with the proper
field structure):
Insert Into tblResults (club,division)
Select
Left(ClubAndDivision,InStr(ClubAndDivision," Div")-1),
Mid(ClubAndDivision,Instr(ClubAndDivision," Div")+4)
From worktable
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Maarten #5
Re: Seperating data within a field
Dear Bob, is this SQL or just Access Sql
Maarten Guest
-
Bob Barrows [MVP] #6
Re: Seperating data within a field
Maarten wrote:
Instr() and Mid() are VBA functions, so this query will only work in Access.> Dear Bob, is this SQL or just Access Sql
Use the corresponding T-SQL functions for SQL Server:
CHARINDEX and SUBSTRING.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Evertjan. #7
Re: Seperating data within a field
Maarten wrote on 01 apr 2004 in microsoft.public.inetserver.asp.db:
>> records:
>> Mellor Park Div1
>> Henley Beach Div1
>> West Lakes Div2
>> Mellor Park Div2
>> Henley Beach Div4DO WHILE NOT RS.eof> Why not importing the whole text in the first field
>
> After importing you select the record with a blank second field
>
> DO WHILE NOT RS.eof
>
> vTxt = Trim(RS("firstField"))
> For x = len(vTxt) to 1 step-1
> If Mid(vTxt, x, 1) = " " then
> part1 = trim(left(vTxt,x-1))
> part2 = trim(right(vTxt, len(vTxt)-x))
> end if
>
> set instruction RS("firstField") = part1
> set instruction RS("secondField") = part2
>
> RS.MoveNext
>
> Loop
vTxt = Trim(RS("firstField"))
aTxt = split(vTxt, " ")
part1 = aTxt(0)
for i=1 to ubound(aTxt)-1
part1 = part1 & " " & aTxt(i)
next
part2 = aTxt(ubound(aTxt))
set instruction RS("firstField") = part1
set instruction RS("secondField") = part2
RS.MoveNext
Loop
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest
-
Darren #8
Re: Seperating data within a field
"Maarten" <nobody@pandora.be> wrote in message news:<PmTac.57393$8B.3750963@phobos.telenet-ops.be>...
Hi Maarten,> You can also seek for DIV
>
> p=Instr(text," div")
>
> part1 = left(text,p-1)
>
> etc...
Is there a way to do it inside the database? I would like to be able
to sort the recordset by club or division and so on and run some
queries.
Your method worked though, and seperating the field on the text "Div"
would work out best for me because there is no set character length
for the field, the club name size and division size could vary. Ie.
Div1 or Div12.
Thanks again,
Darren Stahlhut
Darren Guest
-
Maarten #9
Re: Seperating data within a field
What do you mean with "inside the database"
See the article of Bob, with his info you can do it in the ACCESS database
Insert Into tblResults (club,division)
Select
Left(ClubAndDivision,InStr(ClubAndDivision," Div")-1),
Mid(ClubAndDivision,Instr(ClubAndDivision," Div")+4)
From worktable
Bob Barrows
Split or seek for " Div" space+div
If there is a club Water Divers Div1 you come in problems.
You can reach me on m*e*d*i*a@pandora.be (remove all *)
"Darren" <darrenstahlhut@hotmail.com> schreef in bericht
news:898d00a0.0404011700.a4e1a46@posting.google.co m...news:<PmTac.57393$8B.3750963@phobos.telenet-ops.be>...> "Maarten" <nobody@pandora.be> wrote in message>> > You can also seek for DIV
> >
> > p=Instr(text," div")
> >
> > part1 = left(text,p-1)
> >
> > etc...
> Hi Maarten,
>
> Is there a way to do it inside the database? I would like to be able
> to sort the recordset by club or division and so on and run some
> queries.
>
> Your method worked though, and seperating the field on the text "Div"
> would work out best for me because there is no set character length
> for the field, the club name size and division size could vary. Ie.
> Div1 or Div12.
>
> Thanks again,
> Darren Stahlhut
Maarten Guest
-
Bob Barrows #10
Re: Seperating data within a field
Maarten wrote:
This is true, but it is easily fixed by using InStrRev instead of InStr:> What do you mean with "inside the database"
>
> See the article of Bob, with his info you can do it in the ACCESS
> database
>
> Insert Into tblResults (club,division)
> Select
> Left(ClubAndDivision,InStr(ClubAndDivision," Div")-1),
> Mid(ClubAndDivision,Instr(ClubAndDivision," Div")+4)
> From worktable
> Bob Barrows
>
> Split or seek for " Div" space+div
>
> If there is a club Water Divers Div1 you come in problems.
>
Insert Into tblResults (club,division)
SELECT
Left(ClubAndDivision,InStrRev(ClubAndDivision,"Div ")-1),
Mid(ClubAndDivision,InstrRev(ClubAndDivision,"Div" )+3)
FROM worktable;
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Darren #11
Re: Seperating data within a field
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message news:<#XoTXD#FEHA.3080@tk2msftngp13.phx.gbl>...
> Darren wrote:>> > Hi All,
> >
> > I am designing a website for a tennis club. Each week Tennis Australia
> > release an excel spreadsheet of last weekend's results. I import this
> > into my access DB for use on the website.
> >
> > "The problem"
> > The first coloumn of the spreadsheet is the clubname and division. I
> > need to seperate the two.
> >
> It is definitely a good idea to separate them, especially if you have a need
> to select or sort records by division.
>
> So the first step is to initially import the data into a work table, instead
> of directly into tblResults. Then use this query to insert the records into
> the tblResults table (which I am assuming will already exist with the proper
> field structure):
>
> Insert Into tblResults (club,division)
> Select
> Left(ClubAndDivision,InStr(ClubAndDivision," Div")-1),
> Mid(ClubAndDivision,Instr(ClubAndDivision," Div")+4)
> From worktable
>
> HTH,
> Bob Barrows
Hi Bob, that's perfect :)
Thanks everyone,
Darren Stahlhut
Darren Guest



Reply With Quote

