Dialog Box to Map Fields

12 posts / 0 new
Last post
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi there,

I reworked your Mapping function to work with the open file.  It will give an error if no file is open.

 


Function Mapping()

	fileName = Client.CurrentDatabase.Name
	Set source=client.opendatabase(fileName)
	Set table=source.tabledef
	fields=table.count
	ReDim fieldlist1$(fields)
	j=0
	k=0
	
	For i = 1 To Fields
		Set field=table.getfieldat(i)
		If field.IsCharacter Then
			fieldlist1$(j)=field.name
			j=j+1
		End If
	Next i
	If j = 0 Then 
		MsgBox "There are no character fields in this file"
	End If

mapping_start:
	button = Dialog (dlg)
	

	Select Case button
	Case -1 'ok button selected
		If dlg.DropListBox1 = "" Then
		MsgBox "Please select an SSN field",48,"Problem"
		GoTo mapping_start
		End If
			'get variable
			SSNField = fieldlist1$(dlg.DropListBox1)
	Case 0 'cancel button
		exit_script = true
		GoTo end_function

	GoTo mapping_start
End Select

end_function

End Function

Pages