This example shows the use of the EditAddFieldDefaults property.
Press 'Add' to see a default value for ProductName, QuantityPerUnit, CategoryId and SupplierId fields. Note that the SupplierId select control defaults to the proper CompanyName and CategoryId (read only) is displayed as the corresponding CategoryName lookup value.
  ProductName
1 Alice Mutton
2 Aniseed Syrup
3 Boston Crab Meat
4 Camembert Pierrot
5 Carnarvon Tigers
ProductID 17
ProductName Alice Mutton
SupplierID 7
CategoryID 6
QuantityPerUnit 20 - 1 kg tins
UnitPrice 39
UnitsInStock 0
UnitsOnOrder 0
ReorderLevel 0
Discontinued Yes
 First   Prev   Next   Last   Search   Add   Update   Delete 
This is the code implementing the example:
<!--#include file="VBSdb/inc.asp"-->
<%
   VbsDbNew objVbsDb
   objVbsDb( "MdbPath" ) = "data/nwind.mdb"
   objVbsDb( "Sql" ) = "select * from Products order by ProductName"
   objVbsDb( "GridFields" ) = "ProductName"
   objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update;delete"
   objVbsDb( "EditTableName" ) = "Products"
   objVbsDb( "EditKeyFields" ) = "ProductId"
   objVbsDb( "EditAddFieldDefaults" ) = "ProductName|MyProduct;QuantityPerUnit|1;CategoryId|1;SupplierId|1"
   objVbsDb( "EditReadOnlyFields" ) = "CategoryId"
   objVbsDb( "InputSelectFields" ) = "CategoryId|select CategoryId,CategoryName from Categories;" & _
                                                                "SupplierId|select SupplierId,CompanyName from Suppliers"
   VbsDb objVbsDb
%>
This demonstrative program connects to Nwind.mdb, the well known Microsoft Access sample database: the names of companies, products, people, characters, and/or data mentioned herein are fictious and are in no way intended to represent any real individual, company, product, or event. To download a copy of Nwind.mdb, please visit Microsoft's site.