Hi Dear All,
I have this code that copies a table content on the same table changing ID (Thanks to Arnelgp who helped me with this).
Now I would like to test the Customer ID in the rows to copy, and copy just the records where ID has a specific value (specified on the form).
Thank you in advance
I have this code that copies a table content on the same table changing ID (Thanks to Arnelgp who helped me with this).
Code:
Set rs = db.OpenRecordset("tbl_Vals", dbOpenDynaset)
lngCounter = 1
With rs
lngCounter = 1 'Set records counter on 1
lngID = DMax("idVAL", "tbl_Vals")
With rs
If Not (.BOF And .EOF) Then
.MoveLast
lngRecordCount = .RecordCount
'lngID = ![idVAL]
.MoveFirst
For lngCounter = 1 To lngRecordCount
varidVAL = lngID + lngCounter
varidProduct = ![idProduct]
varidCustomer = "Here I assign a new ID that is chosen on the form"
bm = .Bookmark
.AddNew
![idVAL] = varidVAL
![idProduct] = varidProduct
![idCustomer] = varidCustomer
.Update
.Bookmark = bm
.MoveNext
Next
DoEvents
End If
.Close
End With
Now I would like to test the Customer ID in the rows to copy, and copy just the records where ID has a specific value (specified on the form).
Thank you in advance