The following onOpen event handler reads the contents of a field in a table into an array to be used as the ComboBox object’s options. A table of ice cream flavors has already been opened in a query named flavors1.

function flavorCombobox_onOpen()

   form.aFlavors = new Array() 

   if form.flavors1.rowset.first() 

      do 

         form.aFlavors.add( form.flavors1.rowset.fields[ "Name" ].value ) 

      until not form.flavors1.rowset.next() 

   endif 

   this.dataSource := "array form.aFlavors" 

Later, if someone adds a new flavor, they can add it to the array and update the ComboBox object immediately. (The flavor will be added to the table once it’s approved by the flavor committee.)

function addFlavorButton_onClick()

   form.aFlavors.add( this.form.newFlavorText.value ) // Add new flavor 

   form.flavorCombobox.dataSource += "" // Reassert by adding empty string