DEFAULT VALUES THAT REPEAT PREVIOUS RECORD

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

Guest

HOW DO YOU SET A DEFAULT VALUE THAT REPEATS THE PREVIOUS RECORD (TEXT) IN THE
SAME FIELD?
 
HOW DO YOU SET A DEFAULT VALUE THAT REPEATS THE PREVIOUS RECORD (TEXT) IN THE
SAME FIELD?

Please lay off the CAPS LOCK key. It's hard to read and looks like
you're SHOUTING AT US.

You cannot do this in a Table, but you should be using a Form to enter
data in any case. On a Form, you can use just one line of VBA code; in
a textbox (or other control's) AfterUpdate event, put

Private Sub controlname_AfterUpdate()
Me!controlname.DefaultValue = """" & Me.controlname & """"
End Sub

The """" is needed to insert a single " character to delimit the
default value string.

John W. Vinson[MVP]
 
I copied and pasted the VBA code you provided below and inserted in the the
AfterUpdate event line, but that didn't seem to work. Do I need to enter
anything in the parantheses or quotation marks?

Thanks for your reply, John
 
I copied and pasted the VBA code you provided below and inserted in the the
AfterUpdate event line, but that didn't seem to work. Do I need to enter
anything in the parantheses or quotation marks?

sorry... didn't explain fully!

The AfterUpdate event line should read [Event Procedure]. Erase what's
there; click the ... icon; and choose "Code Builder". Edit the code to
match your control and fieldnames.

John W. Vinson[MVP]
 
Back
Top