Change A Tables field default value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to change the default value for a field in a table from a for
using VB?
For example when the price of a certain product changes I would like to use
a form to change the default value for the field "Prod!" so that when a new
order is generated it reflect the new price. I want to do this with a form so
that I do not have to provide access to the database in design mode.
 
You should be able to set the Default Value for a field in a table with:
CurrentDb().TableDefs("MyTable").Fields("MyField").DefaultValue

A better approach might be to store the current default price for each item
in the Product table, and then look it up from there. This makes it easy for
the user to set the price. The Northwind sample database does this, and the
Orders Subform shows how to lookup the price.
 
Back
Top