My Workorder database has 4 sections where a user must be able to select from combo boxes filled in by data from another database, Equipment.db. I'm trying to figure out the best way to populate these combo boxes when the user opens the Workorder form. The selections for each of the 4 combo boxes will be identical, and based on what the user selects other fields will be filled with data using @XLookup()
I've tested the following code in a practice database, EQLookups, and it works nicely:
** PROGRAMMING SECTION: [Make0] [On Form Entry] **
Var vMake as String
Var vSort as string
//Populate the MAKE0 combo Box with a list of Makes
vMake = @XListValues("equipmnt.db", "Equipment!Make")
// Sort data alphabetically
vSort = @SortStringArray(vMake, 0)
//Remove leading blanks - Empty Records
vSort = @Replace(vSort, ";;", "")
If @Lt(vSort, 1) = ";" then
{
vSort = @replfir(vSort, ";", "")
}
// Remove duplicate entries, if any
vSort = @UniqueStringArray(vSort)
//Make the Combo Box List
PopulateListElement(Make0, vSort)
As you can see, I'm using On Form Entry (code derived from Inside Sesame). However, not all 4 sections will always be used, so I am hesitant to populate all the combo boxes using on form entry, figuring that memory doesn't need to be occupied if not necessary.
Will On Element Entry work as well? Or would it be slower? My main objective is speed of the application; I don't mind writing/re-writing as much code as is necessary.
Thanks in advance for any help.