how to create a data report in vb6 using code instead of the designer? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to create a data report in vb6 using code instead of the designer?

qinniqinni Posts: 16Member
hi,

i need some help from you guys on how to create a data report in vb6 using code instead of the designer. i'm new to vb, and doing a project which gona due 2 weeks later. i have no idea how to achieve this, i only know how to create a data report using designer.

any help will be appreciated. and is there any tutoirals on this one that you know of?

thanks.

qinni

Comments

  • srinivasagsrinivasag Posts: 88Member
    See if thi helps as a starting point

    [code]
    Private Sub cmdRep2_Click()
    Dim rsReport As ADODB.Recordset
    Dim i As Integer
    Dim j As Integer

    Set rsReport = New Recordset
    With rsReport
    .CursorType = adOpenStatic
    .CursorLocation = adUseClient
    .Fields.Append "SNo", adBigInt
    .Open
    .AddNew "SNo", 1
    .AddNew "SNo", 2
    .AddNew "SNo", 3
    .AddNew "SNo", 4
    .AddNew "SNo", 5
    End With

    Set dr2.DataSource = rsReport
    dr2.Sections(3).Controls("txtSNo").DataField = "SNo"
    dr2.Show
    End Sub
    [/code]

    bye

    --------------------------------------
    [b][green]srinivasag[/green][/b]

  • qinniqinni Posts: 16Member
    [b][red]This message was edited by qinni at 2003-1-26 5:49:39[/red][/b][hr]
    : See if thi helps as a starting point
    :
    : [code]
    : Private Sub cmdRep2_Click()
    : Dim rsReport As ADODB.Recordset
    : Dim i As Integer
    : Dim j As Integer
    :
    : Set rsReport = New Recordset
    : With rsReport
    : .CursorType = adOpenStatic
    : .CursorLocation = adUseClient
    : .Fields.Append "SNo", adBigInt
    : .Open
    : .AddNew "SNo", 1
    : .AddNew "SNo", 2
    : .AddNew "SNo", 3
    : .AddNew "SNo", 4
    : .AddNew "SNo", 5
    : End With
    :
    : Set dr2.DataSource = rsReport
    : dr2.Sections(3).Controls("txtSNo").DataField = "SNo"
    : dr2.Show
    : End Sub
    : [/code]
    :
    : bye
    :
    : --------------------------------------
    : [b][green]srinivasag[/green][/b]
    :
    :
    thank you very much, i've tried this code. i made a datareport called dr2 before i run this program, and got a run-time error 9, it says "Subscript out of range". do i need to make a txtSNo in the report before hand?

    thx
    qinni

  • srinivasagsrinivasag Posts: 88Member
    : thank you very much, i've tried this code. i made a datareport called dr2 before i run this program, and got a run-time error 9, it says "Subscript out of range". do i need to make a txtSNo in the report before hand?
    :


    Yes. Have a txtSNo on the Reort at design time. And ensure you have a reference to ADODB.
    Bye
    --------------------------------------
    [b][green]srinivasag[/green][/b]

Sign In or Register to comment.