Solved

Question about Data reports in VB 6.0

Posted on 2009-07-15
21
647 Views
Last Modified: 2013-12-26
1. How to set up The report in Landscape
2.  How to use group, the same way like in MS access
0
Comment
Question by:rfedorov
  • 10
  • 9
21 Comments
 
LVL 10

Expert Comment

by:3_S
ID: 24864529
To set orientation
  DataReport1.Orientation = rptOrientLandscape
  DataReport1.Show

to use a group by
use detail and group header in your datareport
To do so right click on you datareport and click "insert group header/footer"
Your sql command should contain a group by clausule

Feel free to ask additional info.

0
 

Author Comment

by:rfedorov
ID: 24864596
Thank you
Private Sub Command1_Click()
Dim cn1 As Connection
Dim rs1 As Recordset

    Set cn1 = New Connection
        cn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source= " & App.PATH & "\PCR.mdb"
   
        Screen.MousePointer = vbHourglass

'Set rs1 = cn1.Execute("SELECT BatchID, ReviewerDate,RevInspections From Batch " _
'& " WHERE RevInspections <>'' order by ReviewerDate desc;")
Set rs1 = cn1.Execute("SELECT * FROM qry_complete")

'MsgBox "pass"

        Set drAnalyst.DataSource = rs1
        drAnalyst.Orientation = rptOrientLandscape
        drAnalyst.Show
        drAnalyst.Caption = "PCR Report by Analyst"
        Screen.MousePointer = vbDefault
End Sub

it breaks under rptOrientLandscape, giving the error Variable not defined
0
 
LVL 10

Expert Comment

by:3_S
ID: 24864621
rptOrientDefault = 0
rptOrientPortrait = 1
rptOrientLandscape = 2

So you could use 2 instead. on which servicepack is your VB6 installation see:
http://support.microsoft.com/kb/261193
0
 

Author Comment

by:rfedorov
ID: 24864642
it does not give me the property Orientation
0
 
LVL 10

Expert Comment

by:3_S
ID: 24864683
Strange?
Did you add component microsoft common dialog control 6.0 to your project?

I will take till tomorrow before I can answer following updates on this question.
0
 

Author Comment

by:rfedorov
ID: 24864713
I have Microsoft Common  Control 6.0
0
 
LVL 13

Assisted Solution

by:game-master
game-master earned 50 total points
ID: 24865680


good morning!

make sure u have installed vb6 service pack for you to have the
property drAnalyst.Orientation = rptOrientLandscape.

otherwise, this property will not be use...


game-master
0
 

Author Comment

by:rfedorov
ID: 24870122
thank you
how to check which serice pack i have? where to get the service pack?
0
 
LVL 10

Expert Comment

by:3_S
ID: 24872594
To obtain service pack (see my previous post about service pack and datareport orientation)
http://www.microsoft.com/downloads/details.aspx?FamilyID=A8494EDB-2E89-4676-A16A-5C5477CB9713&displaylang=en

Check service pack in Microsoft Visual studio 6
go to menu Help chooose "about Microsoft Visual Basic..."

On which service pack are you currently
0
 

Author Comment

by:rfedorov
ID: 24873299
i downloaded the service pack 6 and still no success:
under the property of Rpt no Orientation property
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 10

Expert Comment

by:3_S
ID: 24873549
is this what you see in you project explorer.
You datareport stands below designer, it's not just a form you called datareport? Maybe this sounds silly but it is to make sure you are using a real datareport.  Property Orientation should be available on your datareport

What are the property's you have available?
datareport.JPG
0
 

Author Comment

by:rfedorov
ID: 24873603
Ok, guys...
I do not know what i did, but after deleting (clearing property of Datamember and Datasource it is working now...
so now i have a question :
 how to insert a group
I know i did Inser group header footer
how  and what should i insert in group header section 1?
0
 
LVL 10

Expert Comment

by:3_S
ID: 24873858
in you sql command you will have something like
select A, B, C from tableX group by A

A should be in you group header and B and C in you detail. (maybe something in group footer, for example a total of something)
This is dificult to give advice without some more input from your side. (can you give you sql statement)

Have you made a datareport before without a group by ( a simple select?) If you have not, maybe you should try this first.
0
 

Author Comment

by:rfedorov
ID: 24873911
let me be specific
select seqnum,status,duedate,title,analyst
from main
group by seqnum,status,duedate,title,analyst
order by analyst,status

it should be:
Pete
           Complete
                          title1 date
                          title2 date
             PEnding
                          title3 date
                          title4 date

John
           Complete
                          title6 date
                          title8 date
             PEnding
                          title0 date
                          title4 date
0
 
LVL 10

Expert Comment

by:3_S
ID: 24874040
for this you will need two group by's. Right click again to insert a second group section in your datareport.
Use two time the group header
first to place name in  (field analyst)
second to place status in (field status)
0
 

Author Comment

by:rfedorov
ID: 24874090
Please look at my screen shoot
i amgetting Report section do not match data source
Doc1.doc
0
 
LVL 10

Expert Comment

by:3_S
ID: 24874182
To accomplish this I think you will have to change you sql command with the SHAPE command (to get your two group by's)
http://support.microsoft.com/kb/189657

I can get back tomorrow. But you can already take a look at the shape command.
0
 

Author Comment

by:rfedorov
ID: 24874290
i am lost now...
0
 
LVL 10

Accepted Solution

by:
3_S earned 200 total points
ID: 24881087
First try on group by then add your second. this should make it more easy

Are all these fields in just one table? is this not split into a table with the analyst and with the various projects they work on?

I can only answer within one week.

    Rcs.Source = "SHAPE{SELECT STATUS, TITLE, DUEDATE" _

             & " FROM TBL_PERSON INNER JOIN TBL_TASK ON TBL_PERSON.PERSON_ID=TBL_TASK.PERSON_ID" _

             & " ORDER BY STATUS,TITLE_NAME" _

             & " } AS GRP1 COMPUTE GRP1 BY 'STATUS'"

Open in new window

0
 

Author Comment

by:rfedorov
ID: 24881305
yes, this one table only
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

747 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

13 Experts available now in Live!

Get 1:1 Help Now