want to repeat value from previous record

P

Pierre

Example of the database:
machine1 system1 item1
machine1 system1 item2
machine1 system1 item3
machine1 system2 item1
machine1 system2 item2
machine2 system1 item1

As you can see, from the "machine" and "system" there's a lot of re-typing.
All these fields comes from combo boxes with queries (so technically, it's a
lot of re-selecting). Now, I would like the default value of the "new record"
be the value from the previous record for these fields, saving a lot of
re-typing/selecting and only needing changing when changing machine or
system. Is there a simple "sequence" to put in the "default" value of the
properties of the field to do that? Thanks.
 
P

Pierre

This is EXACTLY what I wanted the control to do, including the "this session
only" effect. Thanks!!

fredg said:
Example of the database:
machine1 system1 item1
machine1 system1 item2
machine1 system1 item3
machine1 system2 item1
machine1 system2 item2
machine2 system1 item1

As you can see, from the "machine" and "system" there's a lot of re-typing.
All these fields comes from combo boxes with queries (so technically, it's a
lot of re-selecting). Now, I would like the default value of the "new record"
be the value from the previous record for these fields, saving a lot of
re-typing/selecting and only needing changing when changing machine or
system. Is there a simple "sequence" to put in the "default" value of the
properties of the field to do that? Thanks.

For each control on your form that you wish to carry over to the next
new record .....
If the field is NOT a Date datatype, code that control's AfterUpdate
event:

Me![ControlName].DefaultValue = """" & Me![ControlName] & """"

If the field is a Date datatype, then code that control's AfterUpdate
event:

Me![DateControl].DefaultValue = "#" & Me![DateControl] & "#"

You'll have to enter the value just once per session.
It will remain the same for each new record until changed.
These default values will NOT carry over to the next session.
 

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