duplicating some data from previous record on a form

G

Guest

I have a form that I would like to simplify. This form is created to allow
for data to be entered for inventory checks. There are two feilds that very
often repeat. The name of the store and the date of the report. Is there a
simple yet elegant way of facilitating this?
 
J

John W. Vinson

I have a form that I would like to simplify. This form is created to allow
for data to be entered for inventory checks. There are two feilds that very
often repeat. The name of the store and the date of the report. Is there a
simple yet elegant way of facilitating this?

Yep. Put just a single line of code into the AfterUpdate event of each control
that you want autoduplicated:

Private Sub controlname_AfterUpdate()
Me.controlname.DefaultValue = Chr(34) & Me.controlname & Chr(34)
End Sub

This will take whatever the user entered, surround it with " marks to make it
a string constant, and set the control's Default Value to that string.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top