Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating a 2 column report

Posted on 2002-07-25
13
Medium Priority
?
229 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 54

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 70

Accepted Solution

by:
Éric Moreau earned 600 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

972 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