次のスクリプトを使用して、1 つのレイヤーから区画と住所の情報を取得し、新しく作成されたフィーチャの属性テーブルを埋めています。
返されるエラーはありませんが、私が抱えている問題は、recordselect 関数のメモリに間違った情報が残っているように見えることです。どこにポイントを置いても、同じ小包番号と住所が得られます。または、実際には IF 関数が正しく実行されていない可能性があります。
Sub Address
Dim rsCurrentXY
Set rsCurrentXY = Map.Layers("Violations").records
rsCurrentXY.movelast
Dim objXYShape
Set objXYShape = rsCurrentXY.Fields.Shape
Dim pControls
Set pControls= Application.Map.selectionlayer.Forms("EDITFORM").Pages(“PAGE1”).Controls
Dim rsGrid
' Find corresponding map page to the valve point
Set rsGrid = Map.Layers("ACPA_parcels").records
rsGrid.movefirst
Do While Not rsGrid.eof
If rsGrid.fields.shape.Ispointin(objXYShape) Then
pControls("txtAddress").value = rsGrid.Fields("ADD1").Value
Exit Do
End If
rsGrid.Movenext
Loop
' Clean Up
Set rsCurrentXY = Nothing
Set objXYShape = Nothing
Set rsGrid = Nothing
End Sub
(まったく同じことを行う「PIN」と呼ばれる別のサブルーチンがあります。)カスタムフォームのそれぞれの編集ボックスがインスペクターによってアクティブになったときに呼び出されます。
助けてくれてありがとう、ロバート