Referencing fields in the previous record

G

grep

I'm using a form for employee expense report sheets. These sheets can
include data from multiple dates, so each record in the subform (the
details) has a date field. During data entry, there are often several
items for the same date. What I'd like to do is have a new record pull
it's default value from the previous record, but then have it selected
so that it can be immediately changed if it's not correct.

How can I do that?

grep
 
M

Marshall Barton

grep said:
I'm using a form for employee expense report sheets. These sheets can
include data from multiple dates, so each record in the subform (the
details) has a date field. During data entry, there are often several
items for the same date. What I'd like to do is have a new record pull
it's default value from the previous record, but then have it selected
so that it can be immediately changed if it's not correct.


I think this is what you're looking for.

Add code like this to the date text box's AfterUpdate event

Me.txtdate.DefaultValue=Format(Me.txtdate,"\#m\/d\/yyyy\#")

You can force the focus to a specific control on new records
by using code in the form's Current event:
Me.txtdate.SetFocus
 
G

grep

Yeah... that'd work. It'd work for a second field I want to do similarly
(not a date field). All you're doing is setting the default for the
next record. Ingenious. Thanks, Marshall!!

grep
 

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