<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Auto populate sequential unique id's in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/auto-populate-sequential-unique-id-s/m-p/224187#M5780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It can't be impossible right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. sort the table by field Address_ID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Generate ID by adding 1 to the last Address_ID&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;??????&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 May 2011 21:30:31 GMT</pubDate>
    <dc:creator>TonyAlmeida</dc:creator>
    <dc:date>2011-05-23T21:30:31Z</dc:date>
    <item>
      <title>Auto populate sequential unique id's</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/auto-populate-sequential-unique-id-s/m-p/224186#M5779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know how to automatically sequentially calculate numbers in an ID field. I have a VBA script that updates fields with a click but i would like to auto populate a field with sequential number. The field i need auto populate when i click is Address_ID. I need it to some how look at the last number and determine which would be next and populate it. I need to some how incorporate into my VBA script i have. Any help would be gratefully appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2011 21:46:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/auto-populate-sequential-unique-id-s/m-p/224186#M5779</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2011-05-20T21:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Auto populate sequential unique id's</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/auto-populate-sequential-unique-id-s/m-p/224187#M5780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It can't be impossible right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. sort the table by field Address_ID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Generate ID by adding 1 to the last Address_ID&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;??????&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2011 21:30:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/auto-populate-sequential-unique-id-s/m-p/224187#M5780</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2011-05-23T21:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Auto populate sequential unique id's</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/auto-populate-sequential-unique-id-s/m-p/224188#M5781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok i found this Automated unique sequential ID field script that works great for creating sequential unique id's but i need it to generate on a click event. I need it to generate the unique sequential Id when i click on a button the button that populates certain fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another issue is that i need it to update a string filed (Address_ID; CC1234) not just a numeric field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code i found and working with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Option Explicit&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private m_bPopulate As Boolean&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Private m_EditEventChange As Boolean&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Private WithEvents m_pEditEvents As Editor&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Function MxDocument_OpenDocument() As Boolean&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pEditor As IEditor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pUID As New UID&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pUID = "esriCore.Editor"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pEditor = Application.FindExtensionByCLSID(pUID)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If pEditor Is Nothing Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox "Unable to Enable UIC Custom Editing Environment", vbOKOnly, "ERROR...UIC Editing Environment"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Exit Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set m_pEditEvents = pEditor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;m_bPopulate = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;m_EditEventChange = False&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox "Edit Event Field Population is Enabled", vbOKOnly, "AGRC Custom Editing..."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub m_pEditEvents_OnCreateFeature(ByVal obj As esriGeoDatabase.IObject)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Creates new ID number for new feature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pRow As IRow&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim newIDIndex As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pTable As ITable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pCursor As ICursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pData As IDataStatistics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pStatResults As IStatisticsResults&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim IDMax As Variant&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim NewID As Long&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim changeMade As Boolean&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pRow = obj&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If Not m_bPopulate Then Exit Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Find index (as long) of "ID_NUMBER" field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newIDIndex = pRow.Fields.FindField("AddresID_2")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Set up cursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pTable = obj.Table&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pCursor = pTable.Search(Nothing, False)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Set up statistics parameters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pData = New DataStatistics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pData.Field = "AddresID_2"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pData.Cursor = pCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Find the max value of the "ID_NUMBER" field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pStatResults = pData.Statistics&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IDMax = pStatResults.Maximum&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Add 1 to create next (sequential)ID number&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NewID = IDMax + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;changeMade = False&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If newIDIndex &amp;gt; 0 Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pRow.Value(newIDIndex) = NewID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changeMade = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If changeMade Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;m_EditEventChange = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pRow.Store&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;m_EditEventChange = False&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 14:20:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/auto-populate-sequential-unique-id-s/m-p/224188#M5781</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2011-05-24T14:20:19Z</dc:date>
    </item>
  </channel>
</rss>

