Ever make a comboBox and want to prevent the user from entering any values that aren't in your "user defined list" but don't want/need to make a field rule? this example code may get you there.

just place this function on the combobox "canDepart" event.

Code:
FUNCTION restrictToDropDown AS L (fieldName as c = "" )
	'for use when you specify "user defined" choices in a combobox and you want to force the user
	'to pick from the list and not enter other values manually
	
	'pretty name if the actual field name is too cryptic for the user
	if trim(fieldName) = "" then
		fieldname = this.name()
	end if
	
	choices = properties_enum(this.choice)

	dim definedList as C = ""
	for each item in choices
		if "list" $ item then
	 		definedList = definedList + trim(item) + crlf()
		end if
	next
	
	dim listOfValues as C = ""
	for each item in definedList
		listOfValues = listOfValues + trim(eval("this.choice."+item+".value")) + crlf() 
	next
	
	if .not. word_exists(listOfValues,trim(this.value)) then
		ui_beep()
		msgbox("Incorrect value","Please select a valid choice from "+ fieldName +"'s drop down menu")
		this.cancel()
		this.Activate()
	end if	
	
	restrictToDropDown = word_exists(listOfValues,trim(this.value))
	
END FUNCTION
want to take it one step further and prevent the user from saving the form?

1. define a "Layout Variable" on the form e.g. validValue = .t.
2. on every combo box's canDepart pass the functions output to the variable
Code:
validValue = restricToDropDown()
3. on the forms "canSave" create a Cancel Event using action script and specify this in the script's "Cancel event if this condition is true" box
Code:
.not.ValidValue
it is spammy when the user tries to save, so its not perfect, but it gets the job done. of course if they are choosing values from the drop down they'll never see the warning messages anyway >:)