Copy fields from one record into another record in same database

  • Thread starter Thread starter GINNY
  • Start date Start date
G

GINNY

My user creates a block of records with all fields except
the part number blank. When the parts come in they enter
the remainder of the information. If they have multiple
items that are the same except for the part number and the
serial number, they want to hit a button and have all of
the other information they typed in the first record
copied to the new record. I tried the DLookup function
but i could not get it working. Please help
 
When I have been copying information from one record to
the next, I have been using the RecordsetClone
functionality.

Dim db as DAO.Database
Dim recClone as Recordset
Dim var as (String/Integer, whatever)

Set db=CurrentDb()
Set recClone = Me.RecordsetClone


recClone.MoveFirst
Do Until recClone.EOF

--- then what you can do is manuever through the
recClone, asking it to check for something---

If recClone!Name = "Smith" Then
(by the way, notice the ! seperator, very important)
var=recClone!FIELD I NEED TO COPY
End If

recClone.MoveNext

Loop

****remember to type in the following code****

recClone.Close

--- finally return to your current record and set the
field you need updated = var ---

Someone else might have a simpler way to accomplish the
same thing, but this type of process has worked for me
several times in the past.

Hope that helps!
 
Thanks David I will give it a try.
-----Original Message-----
When I have been copying information from one record to
the next, I have been using the RecordsetClone
functionality.

Dim db as DAO.Database
Dim recClone as Recordset
Dim var as (String/Integer, whatever)

Set db=CurrentDb()
Set recClone = Me.RecordsetClone


recClone.MoveFirst
Do Until recClone.EOF

--- then what you can do is manuever through the
recClone, asking it to check for something---

If recClone!Name = "Smith" Then
(by the way, notice the ! seperator, very important)
var=recClone!FIELD I NEED TO COPY
End If

recClone.MoveNext

Loop

****remember to type in the following code****

recClone.Close

--- finally return to your current record and set the
field you need updated = var ---

Someone else might have a simpler way to accomplish the
same thing, but this type of process has worked for me
several times in the past.

Hope that helps!
.
 
Back
Top