change default from form?

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

Is there a way to change the default of a field in my table from my form.
Maybe a txtbox to enter the new default value. Thanks...Randy
 
Hi,


The Default value of the FIELD (not of the CONTROL, a field belong to a
table, a control to the form)? In Access 2000 or later:


CurrentProject.Connection.Execute "ALTER TABLE tableName ALTER COLUMN
fieldName SET DEFAULT=" & DefaultValue


should do, for a numerical default value. Use the standard delimiters for a
date_time or a string default value. Use that VBA line where it would be
appropriate to perform the modification (under a button click, of a button
at that effect, as example).



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top