Repeating field information on form

V

vtj

I am entering new records to a dataset via forms. A couple of the fields in
the records will be the same from record to record. I can set the default
value to be ‘x’ for those. Most of the rest of the fields will be repeated
from the previous entry with some changes. What I want to do is have the
information in a field to repeat from the previous form (record?) but allow
it change on any given record. E.g. the value will default to the previous
record same field value but could still be changed before the record is
saved. From that point I want the new value to repeat on the next record. I
am sure someone has already solved this but have been unsuccessful in finding
it. Thanks for your help.
 
M

Marshall Barton

vtj said:
I am entering new records to a dataset via forms. A couple of the fields in
the records will be the same from record to record. I can set the default
value to be ‘x’ for those. Most of the rest of the fields will be repeated
from the previous entry with some changes. What I want to do is have the
information in a field to repeat from the previous form (record?) but allow
it change on any given record. E.g. the value will default to the previous
record same field value but could still be changed before the record is
saved.


For each text box that you want to "repeat", use code in the
text box's AfterUpdate to set the text box's DefaultValue
property:

Me.[text box].DefaultValue = """" & Me.[text box] & """"

For some (strange?) combinations of date settings in
Windows, you may need to use this for text boxes bound to a
date field:

Me.[text box].DefaultValue = Format(Me.[text
box],"\#yyyy-m-d\#")
 
L

Linq Adams via AccessMonster.com

In your form, you can use the AfterUpdate event of the control holding your
data to set the DefaultValue for the field. From that time forward, until you
either manually change the data or close your form, the data will be entered
automatically in each new record.

Private Sub YourControlName_AfterUpdate()
Me.YourControlName.DefaultValue = """" & Me.YourControlName.Value & """"
End Sub

This syntax works for Text, Number, Date/Time and Memo Field Datatypes
 

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