Results 1 to 2 of 2

Thread: how can design a Datareport in VB6.0?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    5

    how can design a Datareport in VB6.0?

    Dear Friends

    Please any 1 tell me hw can design a datareport in VB6.0 ? wat are all the steps involved in that? pls specify that steps ......



    Thanks
    bala

  2. #2
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308
    I suppose you are using ADO through coding, designing a Data Report using DataEnvironment is more easier.

    Suppose below is your connection and you have a datareport named DataReport1. Assign recordset object to the DataSource property of DataReport and then show your datareport.

    VB Code:
    1. '  General
    2. Dim conn as Connection
    3. Dim Rs as Recordset
    4.  
    5. '  Any other event
    6. Set conn = New Connection
    7.    
    8. conn.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0;Data Source=D:\school\school_database.mdb;Mode=Read|Write;Persist Security Info=False"
    9. conn.Open
    10.    
    11.     Set Rs = conn.Execute("select * from staff where emp_no  like '" & txtEmployeeID.Text & "'order by emp_no ")
    12.    
    13.     Set DataReport1.DataSource = Rs
    14.     DataReport1.Show

    Now, you have passed your recordset to the data report. Now click on Project==>>Add Data Report and set its name DataReport1.

    In Report Header Section, you can place label and put its caption any string you want to display on each report.

    In the Page Header, you can place labels on which write the caption corresponding to you field names such as ID, Name, Phone Number etc.

    Below each label in the Detail section, draw textboxes and set thier datafield property to the name of the databse field you want to show in.

    In this way, your label in page header will show you description and your textbox in detail section will hold the values of the field you assign in datafield.

    You can design these labels and textboxes according to your need. You can draw lines simply as you draw in any other software.

    Right clicking on the report will show you more functions.
    Last edited by usamaalam; Apr 19th, 2003 at 08:47 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width