Results 1 to 2 of 2
  1. #1
    scriptham is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    1

    Question IN(csvlist) statement - csvlist stored in a db record

    Hi

    I would like to make a text document database as follows.


    Store the paragraphs in tblPara with fields idPara and txtPara.
    The id is of course the key which is an int. The txtPara is a string.

    I would then like to store the desired paragraphs by number in tblDoc with fields idDoc and docContent.
    id is again an integer key; docContent is a string.
    For example
    idDoc = 1; docContent = 1,2,9,12,20 or it could be (1,2,9,12,20) .
    The next document could be 5,6,9,12,19,20 etc this would be iddoc=2 etc.

    I then wish to assemble the document in a query + subquery something like the following:
    Code:
    SELECT tblPara.Para, tblPara.idPara
    FROM tblDoc, tblPara
    WHERE ([tblPara].[idPara] IN 
    (SELECT [tblDoc].[DocContent] FROM [tblDoc] WHERE [tblDoc].[idDoc]=1));
    However I try and do this Access returns errors,
    I have tried casts as Cint or Cstr but nothing works.

    Is it possible to recover the value list for the IN() expression from a database?
    Can you suggest how to make the code work please?

    Thanks
    Scriptham

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You might try :

    tblPara
    ------------
    idPara Long (PK)
    txtPara Text

    tblDoc
    ----------
    idDoc Long (PK)
    idPara_FK Long (FK to table tblPara)
    docContent Text

    Relationship
    One ................................. Many
    --------------------------------------------------------------
    tblPara.idPara ..................tblDoc.idPara_FK


    And the query would look like:

    Code:
    SELECT tblPara.txtPara, tblPara.idPara
    FROM tblPara INNER JOIN tblDoc ON tblPara.idPara = tblDoc.idPara_FK
    WHERE (((tblPara.idPara) In 
    (SELECT [tblDoc].[DocContent] FROM [tblDoc] WHERE [tblDoc].[idDoc]=1)));

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Can Data be Stored in a Report
    By jgross in forum Reports
    Replies: 1
    Last Post: 02-02-2011, 10:31 PM
  2. Where are attached files stored?
    By Delta223 in forum Access
    Replies: 3
    Last Post: 01-11-2011, 10:32 AM
  3. stored procedures failure
    By MrGrinch12 in forum Programming
    Replies: 1
    Last Post: 06-23-2010, 12:54 PM
  4. Help with date stored as string
    By weisslakeguy in forum Queries
    Replies: 8
    Last Post: 05-26-2010, 11:14 AM
  5. Number stored as text
    By Mclaren in forum Programming
    Replies: 1
    Last Post: 05-15-2010, 03:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums