Solved

Creating a 2 column report

Posted on 2002-07-25
13
218 Views
Last Modified: 2012-08-14
Any suggestions on how to create a report that has 2 columns?


Here is what I am after, a 1 page report that has 100 records of information shown in 2 colums of 50 records each. There is some header/footer information on the
page as well. It would look something like this...


#####HEADERDATA######

###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###
###COL1###  ###COL2###

#####FOOTERDATA######




The question is, what tool do I use to get VB to do this? The only thing I can think of off hand is to simply use the printer object and built the report the hard way. But if there is a way to use Crystal Reports (the version that comes free with VB6) or the DataReport object, please let me know and I will do it that way instead.


This was an MS Access project and Access has a really great report engine. VB6 seems to be really lacking in that department.
0
Comment
Question by:gwiz
  • 4
  • 3
  • 2
  • +3
13 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7178734
Is the data in Access or is it a text file?  Either Crystal or the Data Report should be able to handle it.

Anthony
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 7179620
>But if there is a way to use Crystal Reports (the version that comes free with VB6) ..

If not wrong, the Free Crystal Report comes with VB5 but not VB6

and as Anthony stated, you can use Data Report (which included in VB6) or Crystal Report (separate application) to develop the reports.

regards
0
 

Author Comment

by:gwiz
ID: 7180017
Crystal reports does come with VB6. You just have to find it on the CD and install it manually. I was a bit upset when installing VB6 and not finding it. Then tech support helped me locate it on the CD.

The data is currently in a non-database recordset. An ado recordset that has no physical file (all in memory) but the data is actually stored in XML files.

If needed, I can put the file on the hard drive in JET or Textfile format. If this can be delt with using the DataReport object, that would be best because it can accept the ADO recordset from memory as the datasource. This I have done before. Just never done a multi-column report.

Can you explain step by step how to set up the report to be multi column? Don't worry about the details of connecting to the datasource as I know that part. Just the steps of creating multi column reports is what I am lacking.

An example walk though using the DataReport would be best but an example of each would be much appreciated (and increase the points to 300)
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 70

Accepted Solution

by:
Éric Moreau earned 200 total points
ID: 7180264
The Datareport engine cannot create real 2 columns reports. You need to create a dummy table with 2 fields (column1 and Column2) and bind your recordset to this dummy table.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7180549
gwiz,

emoreau is absolutely correct.  I misunderstood your original question.

Anthony
0
 
LVL 5

Expert Comment

by:jayeshshah
ID: 7181754
Well you can made the same report in MS-Access & then using the Access object you can open the report. The report becomes visible and you can view it the same way you view it in Ms-Access
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7181949
Very good idea jayeshshah . I just want to warn you that all users need to have Access installed to use this solution.

Here is the code that you need to display an Access report from VB:

Const dbPathName = "c:\database.mdb"
Const strPassword = "PASSWORD"
Dim Acc As Object, db As Object

Set Acc = CreateObject("Access.Application")
Set db = Acc.Application.DBEngine.Workspaces(0).OpenDatabase(dbPathName, 0, False, ";pwd=" & strPassword)
Acc.OpenCurrentDatabase dbPathName, False
Set db = Nothing
Acc.DoCmd.OpenReport "ReportName", acPreview
Set Acc = Nothing
0
 
LVL 3

Expert Comment

by:schworak
ID: 7182060
Most people won't have access which is one reason for removing it from that platform.

I think I will try the suggestion from emoreau first.

Anyone know if Crystal can do true 2 column reports?



Thinking about it now, the fake 2 column method might actually add extra benifits in this case so I may stick with it. But it would be nice to know if Crystal can do it.



emoreau, do you know if it is posible to SHOW/HIDE objects as the report is being built? I ask because I am finding that I may need to hide a field if a special value is in it.
0
 
LVL 5

Expert Comment

by:jayeshshah
ID: 7182063
Dear emoreau,
Definately, i think that users are not dumb enough that they donot even have MSOffice installed on their machine.
0
 

Author Comment

by:gwiz
ID: 7182065
Sorry about that last post. I didn't realize my room mate was still logged in on my compuert
0
 

Author Comment

by:gwiz
ID: 7182066
Sorry about that last post. I didn't realize my room mate was still logged in on my compuert
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7182072
>>Anyone know if Crystal can do true 2 column reports?

Yes


>>Definately, i think that users are not dumb enough that they donot even have MSOffice installed on their machine.

We are not talking about Office, we are talking about Access. Access is not installed with all version of Office (I think they call the Pro version the one that includes Access). Some programmers are not aware of this.


>>do you know if it is posible to SHOW/HIDE objects as the report is being built

I have seen it once (but I can't remember where). Another option is to create a MDB which will only contain reports and you can link it to the database that contain data.
0
 

Author Comment

by:gwiz
ID: 7182084
The Access idea is a good one but not for this project. I will try the DataReport object and see how that goes. Thanks all. I will get back to you soon.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Input past end of file vbs script 9 92
VBA to copy paste columns form one file to other 20 87
Using "ScreenUpdating" 6 63
Formula problem with Excel attachment 6 27
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question