Populating a field on a form using default property

D

Danny Jacobs

My form has multiple rows (records).
The form is based on a simple table (say table1).
The table has 3 fields (say field1, field2 and field3).
I would like the value of field1 for the next new row to default to the
highest previous value of field1 (i.e. MAX value for [table1].[field1]).

I have been trying to achieve this result by entering a select statement in
the default property for the form field but this does not seem to work. Any
ideas?
 
A

Ayelet

try setting the Field1Text.DefaultValue to
DMAX("[field1]", "table1")
if the form has a condition, place the condition as the
third argument.
-> Note that the name of your text box should be differnt
from "field1", ("field1text" is a good name) because
expressions like
field1.defaultValue = func(field1) usually end in #Error.
 

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