Autofilling parts of 2nd record in a Subfrom

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a data entry form (client details) which has a subform (claim
details) based on the many relationship from client details.

After I've entered the first claim and move onto enter the second for the
same client I'd like some of the text fields to be prefilled based on the
first claim.

Can someone point me in the right direction. Thanks
 
Use each field's OnGotFocusEvent with the following excerpt of code (edit YourFieldName in code):

If Not Me![YourFieldName] Then
Exit Sub
Else

Dim rs As Object
Set rs = Me.Recordset.Clone

If rs.EOF Or Not Me.NewRecord Then
' don't do anything if there's no records or it is not a new record
Else
With rs

.MoveLast

Me![YourFieldName] = .Fields("YourFieldName")

End With

End If

End If

Best regards,

Todd Shillam
Hi

I have a data entry form (client details) which has a subform (claim
details) based on the many relationship from client details.

After I've entered the first claim and move onto enter the second for the
same client I'd like some of the text fields to be prefilled based on the
first claim.

Can someone point me in the right direction. Thanks
 
Back
Top