? am having code problems. The attached code is a piece of a database maintenance program. We have added a couple of fields and changed the archive process. The customer did not want us to delete the record when the item became obsolete like we used to do. They wanted most of the fields blanked out so they knew they needed to make more of that item. We changed the process to archive the old record, edit certain fields in the existing records and finish with an update. Saving works ok as does placing a copy in the audit file. As it stands now when it record is closed it is archived (a copy of the record is added to the archive database). The way it used to work is a new record would be added with a new ID number. Now copies are being added to the archive with the SAME ID number. We turned off the primary key so we could do this and now are gerring an error that there are dups in the ID field when we try to read the archive file. I need to look at this code and see if we can ignore the dups in the ID field when we read the archive table. Code is pasted into the comments
## Deliverables
Private Sub icbTables_Click() On Error GoTo Error Dim li As ListItem 'Check if the user chose a regular or archive table to look at Set db = OpenDb([login to view URL]) 'fraReagent is a hidden frame that includes all of the fields of a reagent table 'If the table is not of this type, then all of the fields can be hidden in one go Set rs = [login to view URL](Mid([login to view URL], 2)) [login to view URL] = "REAGENT NAME" 'Tables are indexed on the REAGENT NAME field [login to view URL] = True [login to view URL] = True 'Clear the records list view [login to view URL] 'And fill it with the records With rs While Not .EOF 'If [login to view URL] = "Archives" Then 'Set li = [login to view URL](, "k" & .Fields("ArchiveID"), CheckNull([login to view URL]("REAGENT NAME"))) 'Else Set li = [login to view URL](, "k" & .Fields("ID"), CheckNull([login to view URL]("REAGENT NAME"))) 'End If .MoveNext Wend 'Show details of first record lvRecord_ItemClick [login to view URL] End With If [login to view URL] = "Archives" Then [login to view URL] = False [login to view URL] = False [login to view URL] = False [login to view URL] = False [login to view URL] = False Else [login to view URL] = True [login to view URL] = True [login to view URL] = True [login to view URL] = True [login to view URL] = True End If Exit Sub Error: GeneralErrors "icbTables_Click", [login to view URL], [login to view URL] Resume Next End Sub Open in New Window Select All Tags: vb6