Reports having Data from MSFlexGrid & TextBoxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smartchap
    New Member
    • Dec 2007
    • 236

    Reports having Data from MSFlexGrid & TextBoxes

    In VB6 in a form there are 10 labels and associated 10 textboxes and 2 MSFlexGrids. There are 5 columns in the first MSFGrid and 7 in the second MSFGrid. There are 3 rows in the first grid and 4 in the second. I want to generate a report (may be using DataEnvironment and DataReport, as I don’t have Crystal Report) in such a way the its output should be as follows:

    7 Labels and associated 7 textboxes

    Data in First MSFlexGrid (first row showing headings of columns and next 3 rows data)

    Data in second MSFlexGrid (in similar fashion as for first grid)

    Remaining 3 labels and 3 textboxes in the form



    Please help me, if possible by attaching an example program.

    Thanks in advance.
  • 9815402440
    New Member
    • Oct 2007
    • 180

    #2
    hi
    i could not get what exactlly you want. but i am sending the code to show data of fex grid in a data report

    dim rst as new adodb.recordset
    rst.fields.appe nd "fld1",abdb str

    rst.open

    rst.addnew
    rst.fileds("fld 1").value = flexGrid.textma trix(1,0)

    with datareport1
    .datasource = rst
    .datamember = ""
    .secions('detai ls").controls(" text1").datamem ber = ""
    .secions('detai ls").controls(" text1").datafil d = "fld1"
    .refresh
    .show
    end with

    to display other information, draw lables on the data report and set their captions as follows
    datareprot1.sec tions("details" ).controls("lab le1").caption = "my caption"

    this code is directly typed here and may contain errors.

    hope this will help you

    regards
    manpreet singh dhillon hoshiarpur

    Comment

    • smartchap
      New Member
      • Dec 2007
      • 236

      #3
      Dear Dhillon
      Thanks for the code but in code rst must be linked to some data? For your convenience the sample of my requirement is as follows:

      My form has, say, 6 labels and associated 6 textboxes and 2 MSFlexGrids. MSFlexGrid1 has 4 columns and 3 rows wheras MSFlexGrid2 has 5 columns and 4 rows.

      I want output in DataReport as follows:

      Label1 Text1
      Label2 Text2
      Label3 Text3
      Label4 Text4

      SNo Col1 Col2 Col3
      1 (1,1) (1,2) (1,3)
      2 (2,1) (2,2) (2,3)


      SNo FName LNAme Area City
      1 Ram Agrawal Chowk Lucknow
      2 Alice Williams Gumti New York
      3 Victor Kuznetsov Central Kursk


      Label5 Text5
      Label6 Text6


      Hope it is clear to you now otherwise tell me your email address and I will send you a file having details.
      Thanks.

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        Create a Temporary Table in Database.
        Save the FlexGrid Data in this TempTable, and Show it on DataReport.
        Every time before showing the datareport, Save the Data in TempTable..
        TextBox and Label Values, you can show as Manpreet said.

        Regards
        Veena

        Comment

        • smartchap
          New Member
          • Dec 2007
          • 236

          #5
          Dear QVeen72
          I already have done all this and know how to display labels, textboxes and data from one MSFlexGrid. My problem is to show data from two MSFlexGrids alongwith data from labels and textboxes. For the grids first row must display top row of the grid and then all other rows (as no. of rows increses or decreses as per data in both the grids). Also data of first grid must be displayed and then data of other grid then remaining labels and textboxes. When I design DataReport it dsplays Top row, first row, top row, second row and so on if only one grid is used (which must be top row, first row, second row and so on). Don't know how to display daa from two MSFlexGrids as both have diiferent different number of columns and data type and different no of rows. So how to display data from labels, textboxes and two tables having different fields (may be given one common field for relating) and then remaining labels and textboxes. Also in which section of the datareport as per requirement.
          Thanks in advance Mr QVeen72.

          Comment

          Working...