Serial Number in VB Data Report

280 pts.
VB Data Report
Visual Basic
How can insert a Serial Number in the datareport eg Srl No Rank Name Dept 1 RM T N THAKUR RLY 2 GM T S SINGH RLY 3 INSPR K K PANDEY RLY the data Filtered by RLY from a table and matched only 3 records

Answer Wiki

Thanks. We'll let you know when a new response is added.

I don’t know of a way to do that automatically.

You might need to use a recordset as a source, and programmatically add the serial number to each record before binding the recordset to the datareport.
from SBElectric
One simple option will be:
Go to Report design mode:
1) Create and insert a Text box with Label name as: Srl (short for serial number – like you have indicated).
2) Open the Property Sheet for the Text box – name it as txtSerialNum
3) On Control Source row: enter =1
4) Scroll down the property sheet – For Running Sum: select Over Group (from drop down list)

This will provide the report with a sequential number 1, 2, 3 etc.

When you change the underlying query for the Report to: say “Air Line” – the same report will provide sequential number for Air Lines.

You may use the same concept to provide the Total number of records for Rly.
Just create another Text Box – under Report Footer. Enter =Count([Dept]) on Control Source row.
I just tested in on Access 2007 – works fine.
Good luck .

Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Sudeepcalicut
    I can't find control source row I am using DAO and VB6, Acceess 1) how can I print serial no 2) How can I print the report as in the order of the report 3) How can I sort it
    10 pointsBadges:
  • 15dec121963
    I insert the text box on data report for serial number but did not found source row on properties windows
    35 pointsBadges:
  • Featured Member: SbElectric - ITKE Community Blog
    [...] Serial number in VB data report [...]
    0 pointsBadges:
  • amroasm
    Set rec = DB.Execute("Select * from tablename where keyfield='" & trim(input variable) & "'")
    If rec.RecordCount > 0 Then

    Dim rsDummy As New ADODB.Recordset
    rsDummy.Fields.Append "SrNo", adBSTR
    rsDummy.Fields.Append "fieldname", adBSTR
    rsDummy.Fields.Append "fieldname", adBSTR
    rsDummy.Fields.Append "fieldname", adBSTR

    For iloop = 1 To rec.RecordCount
    rsDummy.Fields("SrNo") = iloop
    rsDummy.Fields("fieldname") = rec.Fields("fieldname") same field
    rsDummy.Fields("fieldname") = rec.Fields("fieldname")
    rsDummy.Fields("fieldname") = rec.Fields("fieldname") & ""

    Next iloop
    Set Datasample3.DataSource = rsDummy

    create datareport add data textbox srno,fieldname,fieldname,fieldname(exaple first name middle name lastname)
    define datareport control field name..

    good luck it will work

    10 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: