Howdy, Stranger!

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

Categories

Report problem

I had created a database programe using vb6 and ms-access, I want to give a serial no. on my report output e.g.

1. Sammy
2. King
3. Ted
4. Billy etc....

and if no. 2 is deleted from the database and when printing a report again the serial no. should go down automatically instead of missing no. 2.

Anybody knows how can I do this, suggestion is warmly welcome please.

Zela

Comments

  • KhalilDutchKhalilDutch Member Posts: 74
    : I had created a database programe using vb6 and ms-access, I want to give a serial no. on my report output e.g.
    :
    : 1. Sammy
    : 2. King
    : 3. Ted
    : 4. Billy etc....
    :
    : and if no. 2 is deleted from the database and when printing a report again the serial no. should go down automatically instead of missing no. 2.
    :
    : Anybody knows how can I do this, suggestion is warmly welcome please.
    :
    : Zela
    :
    :
    Zela,

    If this serial number is coming from an 'autonumber' column (such as ID) in the Database the answer is short; you can't. Acces will continue to use the next number after the last used, not the first available.

    What you could do is collect the list of for the report and use a variable (counter) to generate the serial numbers on the report while looping through the set.
    Something like (to illustrate the idea):

    [code]Dim iCount as integer
    iCount=0
    Do While recordset.EOF=false
    if iCount = 0 then recordset.movefirst
    if iCount <> 0 then recordset.movenext
    iCount = iCount + 1
    print #1, iCount & "." & recordset.["Column name"]
    Loop[/code]
    [b]--Khalil[italic][red]Dutch[/red]--[/italic][/b]
    ___________________________
    [code]If ... Then
    ...
    Else
    ...
    Whatever....[/code]

  • honest_dudehonest_dude Member Posts: 93
    Yes, the serial number cannot comes from the table, it must be generates whenever the report is needed. Can you be more specific in giving codes, i'm a little lost in what you gives here, please give more additional help sort of complete code on this.

    Thank you.

    Zela

Sign In or Register to comment.