Copy value from previous record

  • Thread starter Thread starter Ian
  • Start date Start date
I

Ian

Does anybody know if it is possible to copy the value of
a particular field in the last record to the same field
in the new record of a form automatically. Manually I
can press Ctrl+' but I need to do it automatically or as
the default value for every new record.

Thanks
Ian
 
Dear Ian:

If you are using a form, you can use the After Update event of the bound
control to set a new default value for the control. For example, if you have
a text box named txtBookTitle that is bound to a text type field named
BookTitle, you can use this code:

Private Sub txtBookTitle_AfterUpdate()
Me.txtBookTitle.DefaultValue = """" & Me.txtBookTitle & """"
End Sub

You can omit the four double-quotes on each side of the control name for
numeric fields.

HTH
Fred Boer
 
Thanks very much Fred, that's fantastic, I never thought
I was going to find an answer. (I don't know too much
about code).

Ian
 
You're welcome!

Fred

Ian said:
Thanks very much Fred, that's fantastic, I never thought
I was going to find an answer. (I don't know too much
about code).

Ian
 
Back
Top