Default Data in table view

T

Terrence Carroll

I know this is not good practice but I have a few users insistent on entering
in data directly into a table instead of via a form. I was wondering if in
the Design View of the table it is possible to establish a default value
based upon data entered in another field of the same record. For instance I
would like to set a default value that once the Issue Name field is populated
the Assigned On field will populate with the current date. If the Issue Name
field is already populated I would like to leave whatever date currently
exists in the Assigned On field. If the Issue Name contains a null value I
would like the Assigned On field to remain blank. Is it possible to do this
without the usage of a form?

Thanks,

Terry Carroll
 
G

ghetto_banjo

you could trick the users by creating a form and presenting it in
"Datasheet View". It looks just like a table that way but you can
handle it as a form in the background.
 
D

Douglas J. Steele

It's not possible to set default values based on other values in the table
if you're simply entering data into the tables. The only way is to use the
AfterUpdate event of the control(s) being changed to update the DefaultValue
for other control(s) on a form.
 
J

John W. Vinson

I know this is not good practice but I have a few users insistent on entering
in data directly into a table instead of via a form.

I like ghetto_banjo's suggestion: subtlety and deceit are sometimes useful. A
Form can be made to look very like a table datasheet. If you're allowing users
to see or use the Tables window you're in trouble... that's just too risky,
it's easy to make a mistake ("I don't need any data from previous years in my
report, I'll just delete those records from my copy of the database"... and
it's their frontend to the master data file).
I was wondering if in
the Design View of the table it is possible to establish a default value
based upon data entered in another field of the same record.

No, because a default is applied the instant the new record is created. The
other field will not have been filled in at that point.
For instance I
would like to set a default value that once the Issue Name field is populated
the Assigned On field will populate with the current date. If the Issue Name
field is already populated I would like to leave whatever date currently
exists in the Assigned On field. If the Issue Name contains a null value I
would like the Assigned On field to remain blank. Is it possible to do this
without the usage of a form?

Not in Access (at least not yet). In SQL/Server you could use a trigger.
 

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