DEFAULT VALUES THAT REPEAT PREVIOUS RECORD

J

JOHN@&m

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

John Vinson

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]
 
J

JOHN@&m

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
 
J

John Vinson

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]
 

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