Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Multiple columns in a data report

Multiple columns in a data report

Scheduled Pinned Locked Moved Visual Basic
helptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 667555
    wrote on last edited by
    #1

    Hello, I'm trying to set up a report so that it will have several different columns for the same set of fields (like creating columns in word) that my data will be displayed in. For example... I have about 100 records to display on each page of the data report... The way it is right now, if I want to print out a report of those records it prints off several pages with just one column of the set of fields. I want to set up multiple columns for the same fields so that they will all fit on one page. Instead of having Field1 Field2 Field3 on a page, I will have Field1 Field2 Field3 : Field1 Field2 Field3 : Field1 Field2 Field3 on a page I hope that made sense. Thanks so much for your anticipated help. TimDasa

    D 1 Reply Last reply
    0
    • U User 667555

      Hello, I'm trying to set up a report so that it will have several different columns for the same set of fields (like creating columns in word) that my data will be displayed in. For example... I have about 100 records to display on each page of the data report... The way it is right now, if I want to print out a report of those records it prints off several pages with just one column of the set of fields. I want to set up multiple columns for the same fields so that they will all fit on one page. Instead of having Field1 Field2 Field3 on a page, I will have Field1 Field2 Field3 : Field1 Field2 Field3 : Field1 Field2 Field3 on a page I hope that made sense. Thanks so much for your anticipated help. TimDasa

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      How are you generating the report? Using Crystal Reports? Or are you using code you wrote to send data to the printer? How are you tracking your data? Using a RecordSet object? Or using an Array? Need just couple more details here! :) RageInTheMachine9532

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        How are you generating the report? Using Crystal Reports? Or are you using code you wrote to send data to the printer? How are you tracking your data? Using a RecordSet object? Or using an Array? Need just couple more details here! :) RageInTheMachine9532

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Thanx for your response. I have the data in a microsoft access database. I designed the report using vb 6 data report which gets it data from a data environment. I then used an SQL statement to filter the records. If you have a better way of extracting the data from the tables pls let me have it. Thanx.

        D 1 Reply Last reply
        0
        • A Anonymous

          Thanx for your response. I have the data in a microsoft access database. I designed the report using vb 6 data report which gets it data from a data environment. I then used an SQL statement to filter the records. If you have a better way of extracting the data from the tables pls let me have it. Thanx.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          OK. In that case, you should be using a RecordSet object to track the data in your app. Next, you didn't mention how you were generating your report, so I'll assume your writing the code for it yourself. Now, you'd have to print the data out, something like this (assuming 50 rows per column):

          Rec(0).Field1 Rec(0).Field2 Rec(0).Field3 : Rec(50).Field1 Rec(50).Field2 Rec(50).Field3
          Rec(1).Field1 Rec(1).Field2 Rec(1).Field3 : Rec(51).Field1 Rec(51).Field2 Rec(51).Field3

          A simplified view of the code might look something like this (not actual code):

          Dim Index as Integer
          Dim rsData as RecordSet (Your data is in here)
          Dim strOutput as String

          'Output your headers here
          '
          For Index = 0 to rsData.Count - 1
          strOutput = rsData(Index).Fields(1).ToString & " " & _
          rsData(Index).Fields(2).ToString & " " & _
          rsData(Index).Fields(3).ToString

          Try
              strOutput = strOutput & " : " & \_
                      rsData(Index + 50).Fields(1).ToString & " " & \_
                      rsData(Index + 50).Fields(2).ToString & " " & \_
                      rsData(Index + 50).Fields(3).ToString
          Catch
          End Try
          Print strOuput
          

          Next

          Again, this is a greatly simplified example and will NOT compile! But it should be enough to give you an idea of what is going on. RageInTheMachine9532

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups