Check if Field Exists

Function checkIfFieldExists(sFilename As String, sFieldname As String) As Boolean
	Dim db As database
	Dim table As table
	Dim field As field
	
	Set db = client.opendatabase(sFilename)
		Set table = db.TableDef
			On Error Resume Next
			Set field = table.GetField(sFieldname)
				If err.number = 0 Then
					checkIfFieldExists = False
					err.number = 0
				Else
					checkIfFieldExists = True
				End If
			Set field = Nothing
		Set table = Nothing
	Set db = Nothing
End Function