Record Number in Data Report (VB6 - SP6)
Hi Gurus,
I am using data report but I stuck how can I show record number (Serial number column) in my report?
report without serial number is working fine ?
my code is : -
Code:
Public Function Shd_int_pvtE()
shsql = "Select m.reader, m.stat, m.cons, m.mtype, m.cdat,m.cmrd,m.cbtp,m.anam,m.mtrn,S.RDATE, " & _
"S.MTRD,S.BTYP,S.RMONTH, MTRD - CMRD as consumption " & _
"from mnbmast M LEFT join sitemr s on M.STAT = S.STAT AND M.CONS = S.CONS " & _
"where m.reader = " & txtreader.Text & " " & _
"and left(mtype,1) = 1 "
Set shrs = shcon.Execute(shsql)
Do Until shrs.EOF
shsreader = shrs!READER
'shdla = shrs!MTYPE
'shsstat = shrs!STAT
'shscons = shrs!CONS
'shmcbtp = shrs!CBTP
'shmmtrn = shrs!MTRN
'shmcdat = shrs!CDAT
'shmcmrd = shrs!CMRD
'shsrdate = shrs!RDATE
'shsmtrd = shrs!MTRD
'shsbtyp = shrs!BTYP
'shsrmonth = Nz(RMONTH, "0")
'shanam = shrs!ANAM
'shsconsumption = CONSUMPTION
shrs.MoveNext
Loop
Set DataReport4.DataSource = shrs
DataReport4.ReportWidth = 11.5
DataReport4.TopMargin = 0.25
DataReport4.LeftMargin = 0.75
DataReport4.RightMargin = 0.25
DataReport4.BottomMargin = 0.25
DataReport4.Sections("Section4").Controls.Item("rptschhdr").Caption = "Schedule for Electric - Private"
DataReport4.Sections("Section2").Controls.Item("rptreader").Caption = Format(shsreader, "0000")
DataReport4.Sections("Section2").Controls.Item("ConsName").Caption = "Consumer Name"
With DataReport4
.Orientation = rptOrientLandscape
.Show
End With
End Function
can any one help me how to add S.NO field in my report or can I use rownum in my sql query I have tried but I dont know how to actually use it in VB 6.
Thanks
Re: Record Number in Data Report (VB6 - SP6)
Do you have a Serial No. column in your database? If not then it should be a little bit complex to add another field for such. What I have in mind is you can create a CREATABLE recordset that you could dump your values from your table then while doing so you could try adding those row numbers then used that recordset as the datasource of your DataReport.
Re: Record Number in Data Report (VB6 - SP6)
Quote:
Originally Posted by dee-u
What I have in mind is you can create a CREATABLE recordset that you could dump your values from your table then while doing so you could try adding those row numbers then used that recordset as the datasource of your DataReport.
Dee-U: Thanks for your response, may you please give me a code how can I use CREATABLE and so on ? I remain thankful to you.
Re: Record Number in Data Report (VB6 - SP6)
i have this problem too ... plz help
i want to show row number for each record that had fetched in report via data report
but i don't know how i can do this
each record in final report begin from number 1 ....
for example
1 jack robert 110 usa
2 nick stone 230 usa
.
.
.
but in DB my record have no number
Re: Record Number in Data Report (VB6 - SP6)
here is the solution of ur problem
make two formulas in crystal report like
formula 1
formula 2
in formula 1 write this
Shared Numbervar Test:=0
and in formula 2 write this
Shared Numbervar Test:=Test+1
place formula 2 in the detail section and place formula1 in group field....!
Your problem will be solved
take care n be happy
iactulip