Re: Newbie question regarding text strings

From: Brett Collings [429338] (bac_at_nomail.please.nz)
Date: 10/31/04


Date: Sun, 31 Oct 2004 22:54:59 +1300

Good going so far for a newbie however I would strongly counsel
against blending all the names and addresses into one field.

In databases, these elements are kept seperate to make it easy to
find, query or use them. As you have found with your query, it
becomes a nightmare to break them up using delimiters.

I'd suggest you use the industry Best Practice structure so that your
database can talk to others at some time in the future. Try this for
a structure

tblAuthor
======
AuthorID Autonumber Primary Key
AuthFname Text First Name
AuthMname Text Middle Name or inital
AuthLname Text Last Name
AuthAdd1 Text Apt/House No & Street
AuthAdd2 Text Suburb
AuthCity Text City Name
AuthZip Text Can eventually be populated
                                             using the City field or
                                             manually entered

Use your delimiters to break your data into bits using InStr(), Len(),
Right(), Mid() and Left(), make a SELECT query.
and then when you're happy with the result, create a Make Table query
out of it. Just writing that query is a nightmare, and so it will
continue for the life of your database unless you do it now.

I just tried to do an example for you but it's late Sunday night and I
just didn't have the time to work it all out, sorry.

Cheers
Brett

On Sat, 30 Oct 2004 22:39:54 -0400, V Chandra
<vikramchandra@comcast.net> wrote:

>Hello all,
>
> A simple question probably, I just don't know where to look it up.
>
> I have a table with two fields - Author_name and Author_Address.
>example given below.
>
> AuthorName: Abel (*) Baker (*) Charlie (*) ' delimiter is
>paren-star-paren
> Authoraddress: Abeladdress. Bakeraddress. Charlieaddress. '
>delimiter is period
>
>All I want to do is to create a new table with the fields - AuthorID
>(autonumber), Authorname, authoraddress.
>Each row must have only one author and that one author's address.
>
>How do I go about creating a query to do this?
>
>What I have so far is :
>SELECT Left([AUTHOR],InStr(1,[AUTHOR],"(*)")-1) AS Name,
>Left([AUTHOR_ADDRESS],InStr(1,[AUTHOR_ADDRESS],".")-1) AS Address
>FROM Temporary_Author_Table;
>
>Which gives me the first name and first address for each row and thats
>it. It skips subsequent authors in a row.
>
>Any advice is much appreciated. Please email if possible to
>VJ@VChandra.com
>
>thanks in advance
>Vijay Chandra

Cheers,
Brett

----------------------------------------------
Be adventurous, be bold, be careful, be a star
----------------------------------------------
Brett Collings
Business & Systems Analyst
Management Information Systems Developer



Relevant Pages

  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: OT: SQL
    ... query processing. ... FROM Employees e, Employees m, Management mgt ... Manager and Employee Salaries. ... The scheme used does not model database files in general, ...
    (sci.logic)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... boxes from the form header, events, code, etc and ran the form query source ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would be ...
    (microsoft.public.access.conversion)
  • RE: Import external data - web query
    ... Your reply for my query is very extensive, this is for importing a file from ... The data source I want isn't listed in the Select Data Source dialog box. ... information used to connect to a database. ... Check your driver First, make sure you have the right ODBC driver (Open ...
    (microsoft.public.excel.misc)
  • Re: access 2003
    ... I removed the parameters from the form query source. ... synchronize combo boxes to the detail section or the parameter form query ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would ...
    (microsoft.public.access.conversion)