Populate Primary field List

This function will populate an array with information that can be used in a field list for a custom menu.

Snippet: 
Function populatePrimaryFieldList(fileName As String)
	Dim source As Object
	Dim table As Object
	Dim rst As Object
	Dim field As Object
	Dim  i As Integer
	
	'obtain the information from the primary database

	Set source=client.opendatabase(fileName)
	Set table=source.tabledef
	Set rst =source.recordset
	'obtain the number of fields in the primary database
	primaryNoFields=table.count
	
	ReDim primaryFields(primaryNoFields)
	ReDim primaryUseField(primaryNoFields)

	'set the default primary number of fields to use as all of them
	'primaryNoOfFieldsToUse = primaryNoFields
	'set the defaut fields to use as all of them
	For i=1 To primaryNoFields
		Set field=table.getfieldat(i)		
		primaryFields(i)=field.name
	        	primaryUseField(i)= false	
	Next i
	
	Set source = Nothing
	Set table = Nothing
	Set rst = Nothing
	Set field = Nothing

End Function