By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,595 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

Reports having Data from MSFlexGrid & TextBoxes

smartchap
100+
P: 236
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.
Feb 2 '08 #1
Share this Question
Share on Google+
4 Replies


9815402440
100+
P: 180
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.append "fld1",abdbstr

rst.open

rst.addnew
rst.fileds("fld1").value = flexGrid.textmatrix(1,0)

with datareport1
.datasource = rst
.datamember = ""
.secions('details").controls("text1").datamember = ""
.secions('details").controls("text1").datafild = "fld1"
.refresh
.show
end with

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

this code is directly typed here and may contain errors.

hope this will help you

regards
manpreet singh dhillon hoshiarpur
Feb 3 '08 #2

smartchap
100+
P: 236
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.
Feb 4 '08 #3

QVeen72
Expert 100+
P: 1,445
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
Feb 4 '08 #4

smartchap
100+
P: 236
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.
Feb 4 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.