×
Menu
Index

3.6.2.3. Set Default Field Values for Detected Document Types

 
This sample script allows you to set a default value for your fields when a Document Type is assigned or detected.
 
 
Dim SQLString
 
' Connect to the database
Set MyDB = ChronoApp.CreateAdoDBConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Dbs\suppliers.mdb;Persist Security Info=False;","","")
 
SQLString = "Select * from Suppliers where AccountRef = '" & UserField_Document_Type.value & "'"
 
' Search a value based on the document type
Set rsCustomers = MyDB.Execute(SQLString)
 
If Not rsCustomers.EOF Then
UserField_AccountRef.value = rsCustomers.Fields("NominalCode")
' This will set a new default value for the field AccountRef for the current Document Type.
Call DocumentType.SetFieldDefaultValueForType("AccountRef",UserField_AccountRef.value)
End If