Solved

Creating a 2 column report

Posted on 2002-07-25
13
214 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
Comment Utility
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 49

Expert Comment

by:Ryan Chong
Comment Utility
>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
Comment Utility
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
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 200 total points
Comment Utility
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
Comment Utility
gwiz,

emoreau is absolutely correct.  I misunderstood your original question.

Anthony
0
 
LVL 5

Expert Comment

by:jayeshshah
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry about that last post. I didn't realize my room mate was still logged in on my compuert
0
 

Author Comment

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

Expert Comment

by:Éric Moreau
Comment Utility
>>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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now