Updating Table Field Properties

  • Thread starter Thread starter J. Lund
  • Start date Start date
J

J. Lund

I need to due an update to the "Default Value" of several fields in a table.
Instead of having the user update the table, is there a way to
programmatically do this? (The current "Default Value" is =Now() to put in
the current system date. I would like to change it to Null.)
 
I need to due an update to the "Default Value" of several fields in a table.
Instead of having the user update the table, is there a way to
programmatically do this? (The current "Default Value" is =Now() to put in
the current system date. I would like to change it to Null.)

You can do this by chaning the default value of the field in the
source table.

- Open the table that contains the field you wish to be Null in
design view.
- Highlight the field that you wish to change
- Toward the bottom of the page you will see 2 tabs; "General" and
"Lookup". Under teh General tab look 6 properties down and you will
see "Default Value"
- In the white space provided enter the word Null

This will make all new records created in this table have a null value
in the selected field.
 
- Open the table that contains the field you wish to be Null in
design view.
- Highlight the field that you wish to change
- Toward the bottom of the page you will see 2 tabs; "General" and
"Lookup". Under teh General tab look 6 properties down and you will
see "Default Value"
- In the white space provided enter the word Null

Actually, if you want the field to be filled in with NULL simply don't provide
any default value at all.

Note that changing the default value will affect only new records added after
the change - currently existing records will retain the date/time that the
record was created.

John W. Vinson [MVP]
 
I was hoping there was a way that a program could change the field since
this application was sent out to various groups which do not have a lot of
access training.
However if this is the only way, I will have to go with it.
 
I don't see what difference it makes that the groups don't have a lot of
Access training: they don't have to set the Default Value. You do it once,
and it's done for their application.

It is possible to set the default value of a table field programmatically.
All you need is:

CurrentDb.TableDefs("[NameOfTable]").Fields("[NameOfField]") = ""

(it's not possible to set the Default Property to Null)
 
Thanks Douglas. I appreciate all your time. In error some fields were set
to the system date. This will rectify the situation without the users
knowing other than they have to run a fix.

Douglas J. Steele said:
I don't see what difference it makes that the groups don't have a lot of
Access training: they don't have to set the Default Value. You do it once,
and it's done for their application.

It is possible to set the default value of a table field programmatically.
All you need is:

CurrentDb.TableDefs("[NameOfTable]").Fields("[NameOfField]") = ""

(it's not possible to set the Default Property to Null)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


J. Lund said:
I was hoping there was a way that a program could change the field since
this application was sent out to various groups which do not have a lot of
access training.
However if this is the only way, I will have to go with it.
 

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

Back
Top