syntax help in copying the previuos record

  • Thread starter Thread starter sheela
  • Start date Start date
S

sheela

Hi I am new to database designing. This problem may be
very simple to most of you. But I spent couple of hours
with no success.
I will try to state my problem briefly.

I have a form to enter new records to the database. In my
database a group of records commonly has the same data,
in a number of fields in a series of records. I want to
create a command button for copying a subset of data from
previous record. Or copy data from the previous record
automatically when a new record is created.
I need the syntax help. I really appreciate any help.

Thanks in advance,
sheela
 
Sheela:

Here is an example:
HS
-------------------------
Public Sub AddDetailLine(ASEQ As Integer, QTY As Double)
Dim db As DataBase, rst As DAO.Recordset
Set db = CurrentDb()
Set rst = Me.RecordsetClone

On Error GoTo Err_AddDetailLine:
With rst
.AddNew
!ASEQ = ASEQ ' New Value supplied through parameter
!QTY= QTY ' Another New Value supplied through parameter
!TYPE = Me.txtTYPE
!NUMBER = Me.txtNUMBER
' other table fields that you need
.Update
.Move 0, .LastModified
End With
Me.Bookmark = rst.Bookmark

Exit_AddDetailLine:
Exit Sub

Err_AddDetailLine:
MsgBox Error$
Resume Exit_AddDetailLine:
End Sub
 
Back
Top