Default Value from last record in table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am trying to get a field on my form to have a default value based on what
was entered in that field on a previous occurrence (record).

I tried using DLast, but I read it was unreliable...

Does anyone have a better suggestion?

Thanks,
 
By the way, my field is CURRENCY.

I found here a solution for TEXT and COMBO BOX but not for numeric fields
and frankly I do not know how to "change" the so it will work with numeric
fields :(
 
Sorry, did not get it... how does that get the LAST record?

also your other link is the one I found to copy over the text and combo
values but how do I do it for a numeric field?
 
The fact that this is a currency field should not pose a problem.

If "last record" means the last one you were editing/entering, the MVPS site
one will do it.

If "last record" means the last one currently in the form, however that
happens to be filtered/sorted, the one from my site will do that.

If "last record" means the highest value of the field in the table, you
could use DLookup() to read it from the table.

If "last record" means the value from a field, based on the highest value in
another field, you could use ELookup() to get it:
http://allenbrowne.com/ser-42.html

Once you have the "last record" value, you can assign the value in
Form_BeforeInsert. If you set the DefaultValue, be sure to include the extra
quotes, as in the MVPS example.
 
Back
Top