Discussion Locked

vb 6 DataReport

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hi,
I made a database application by VB 6 and I have two problems:
1-I cannot find a way to have one field in my Data report with serial numbers (1,2,3) and in the same time these number should change automaticlly if I add or delete any record
2-I have to messages when I install this application "An error occurred while registering file MSADO20.TLB" and the message for "SIMPDATA.TLB"
please help me

5 replies

by r'n'd lab

It seems as if your first problem cannot be solved with an autonumeric field. I think you should try with a numeric field, giving it the previous record value + 1, and with a private sub in which it updates all the subsequent records when you delete one.
For example:
private sub UpdateRecords (byval dummynum as integer)
with RsTable
.movefirst
do until .IndexNum = dummynum
.movenext
loop
.delete
do until .eof=true
.edit
.indexnum=indexnum-1
.update
loop
end sub

I think it should work

by puzzle

Nice work of Ortegahey , but if your serial number assignement order happens to have an incident on your records (maybe you are replacing record) you just have to retrieve the deleted record number and assign it to a new record that replaces the old record otherwise copy and paste Ortegahey's work.

by pjfromottawa

I would create an autonumber primary key field and a second field that you use for display purposes that would satisfy your "no gaps" requirement (apply the subroutine to this field). If the application becomes multi-user, this should result in much less (not "no") record contention. The fact that you're re-numbering a field in other records could be an issue if it's multi-user and someone else (or you) has another record open. "It all depends"

This discussion is closed to new replies.