changing defaultvalue

  • Thread starter Thread starter dirk van waes
  • Start date Start date
D

dirk van waes

Hi,
On a form, I want (depending on what the user wants) to be able to change
the defaultvalue of a field in a table. (not the source-table of that form).
Is that possible? How do I do that?
TIA
Dirk
 
That's an unusual requirement. I assume you have good reason for it?
Try the following:

(untested)

dbengine(0)(0).tabledefs![YourTableNameHere].fields![YourFieldNameHere].defaultvalue
= 99

Replace 99 with the desired new default value.

HTH,
TC
 
PS. If you have not yet /set/ a default value for that field, that code
will probably fail with a "property not found" error. You could enhance
the code to create the DefaultValue property if it did not yet exist,
or, you could just ensure that you set a default value manually, once,
so Access will create that property for you.

HTH,
TC
 

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

Similar Threads


Back
Top