Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2011
    Location
    IL, USA
    Posts
    10

    Exclamation Unanswered: Looping over 1 row (and 25 columns) in 'Detail' section of Report

    Hi,

    So basically i have a report named 'invoice' in which i have a text box which should list all the 'parts used' to fix a tool. so, i have the text box in the 'Detail' section of the report so that it can repeat itself as long as there is more data in the table. however, it is supposed to read all its data off 1 row.

    so, in my table, i have 'part1', 'part2' and so on till 'part25'. so, the text box must display all the information from each of these columns (except for when they are empty).

    to sum it up, the 'Detail' section of the report should loop over 1 row (but about 25 colums for the 25 parts) instead of looping over the rows.

    Is there any way to do this? or any other better way of doing all this. Please help me out!!!!!!!!!! I would really really appreciate it.

    Thanks!!

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You need to use a UNION query to transform the columns into rows:
    Code:
    SELECT Column_1 FROM MyTable
    UNION
    SELECT Column_2 FROM MyTable
    UNION
    SELECT Column_3 FROM MyTable
    UNION
    SELECT ...
    UNION 
    SELECT Column_n FROM MyTable
    If you include other columns than Column_1 to Column_n in the query, don't forget that all SELECT statements must return the same number of columns.
    Have a nice day!

  3. #3
    Join Date
    Mar 2011
    Location
    IL, USA
    Posts
    10
    Thanks for the prompt reply!!

    However, I'm kind of new to Access. So, I was wondering where do I put this code?? do I put it in the 'controlsource' of the textbox??

    Thanks in Advance!!

  4. #4
    Join Date
    Mar 2011
    Location
    IL, USA
    Posts
    10
    Hey,

    Nevermind, I figured that out.

    Thanks a lot for your response!! It helped a lot!!

    Romit.

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome
    Have a nice day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •