Automatically Populate a field

M

Melissa

How do you automatically populate a field with the first or max date in a previous record? I tried first[My Date] and it returned 12/31/1899. How do I get it to populate after I have recorded a date for a specified record?
Thank, Melissa
 
K

Ken Snell

Define "previous record"..... that is important to knowing how to advise you
on this.

If you just want to find the maximum date in the table and then add
something to that (or use that date), you can use as a default value for a
control in a form an expression similar to this:
=DMax("DateFieldName", "TableOrQueryName")


--
Ken Snell
<MS ACCESS MVP>

Melissa said:
How do you automatically populate a field with the first or max date in a
previous record? I tried first[My Date] and it returned 12/31/1899. How do
I get it to populate after I have recorded a date for a specified record?
 
M

Melissa

Okay, There is a field on a form, called [Brace Start Date] in the table "SURGDATA]. Basically, once you define the date for the first record, all subsequent records should populate with that date. Any ideas?
Thanks
 
K

Ken Snell

On the AfterUpdate event of the control (I assume it's named Brace Start
Date), put this code to define the default value for subsequent records
(until the form is closed):

Private Sub Brace_Start_Date_AfterUpdate()
Me.[Brace Start Date].DefaultValue = """" & Me.[Brace Start Date].Value
& """"
End Sub

--
Ken Snell
<MS ACCESS MVP>

Melissa said:
Okay, There is a field on a form, called [Brace Start Date] in the table
"SURGDATA]. Basically, once you define the date for the first record, all
subsequent records should populate with that date. Any ideas?
 
T

trini007

I posted this in the General Access forum, but I didn't get any
help...but this thread is similar to what I want.


I'm automating some tasks, and I created a form for entering data. Now
there are some data that don't change too often...so I want to
automatically duplicate data in a particular field in one record to the
same field in the next record. They should just enter this data once,
but can change it if they need to, bearing in mind that change will
then be duplicated for future records...ideally once entered, there
shouldn't be a tab stop in that field for the coming records . The data
must also be saved for query and reporting purposes, which are also
automated...but that part is no problem for now.

I came up with some solutions, but they so-so. I haven't got what I
really want as yet. I'm using access 2000
 

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