Newbie question: "Same as Previous"?

J

JMF

This regards table data entry:

Using the normal facilities for adding new records to a table, I'd like to
be able to set the default value for a field to "same as previous" -- that
is, whatever the value was in the last record was added. This is obviously
for convenience when adding a whole set of new records where one field
happens to be the same every time.

But I can't figure out how to do it. Can anybody enlighten me?

Thanks!

John
 
K

Ken Snell \(MVP\)

Don't enter data directly into tables...that is the purpose of forms. Using
a form, you can use programming to reset the Default Value to what was last
entered for that control on the form. This is done by this type of code on
the AfterUpdate event for the control:

Private Sub ControlName_AfterUpdate()
Me.ControlName.DefaultValue = """" & Me.ControlName.Value & """"
End Sub
 
A

Al Camp

JMF,
On the AfterUpdate of that field, make that value the DefaultValue for the field. The
next New record will have that value. That DefaultValue will remain in effect until
manually changed to something else... then that becomes the new default.
Text example...
YourField.DefaultValue = " ' " & [YourField] & " ' "
(spaces added to quotes for clarity...remove them when coding)
 
J

JMF

I think you've convinced me, Ken. Time to move entirely over to forms for
data entry. It's clear now that this is what gives the necessary control
over things. Thanks!

John
 
J

JMF

Al,

Thanks very much - it seems clear after reading both your reply and the one
above that this is the necessary approach and I'll move over to forms now
and implement it.

John

Al Camp said:
JMF,
On the AfterUpdate of that field, make that value the DefaultValue for
the field. The next New record will have that value. That DefaultValue
will remain in effect until manually changed to something else... then
that becomes the new default.
Text example...
YourField.DefaultValue = " ' " & [YourField] & " ' "
(spaces added to quotes for clarity...remove them when coding)

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

JMF said:
This regards table data entry:

Using the normal facilities for adding new records to a table, I'd like
to be able to set the default value for a field to "same as previous" --
that is, whatever the value was in the last record was added. This is
obviously for convenience when adding a whole set of new records where
one field happens to be the same every time.

But I can't figure out how to do it. Can anybody enlighten me?

Thanks!

John
 

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