title: How to retrieve the auto increment field name from a table?
body: <p>I'm writing a function that gets the name of the AutoIncrement field in any given table</p>
  
  <pre><code>public sub GetID(ByVal tblName As String) As String
      Dim rs as RecordSet
      Dim fld as field
  
      For each fld in rs.Fields
          if fld.type = 'autoIncrement?'
              Exit for
          End If
      Next fld
      GetID = fld.Name
  End Sub
  </code></pre>
  
  <p>I tried looking online but I couldn't find a dao field type for AutoIncrement. I noticed there is a type called DbGuid That seems to have something to do with this, but I can't figure out what it is. I  Also saw other sql DBMS that have a function for this sort of thing, but I couldn't find such a function in MS Access.</p>
  
  <p>It is a big database and I don't know what the AutoIncrement field's name might be. So I can't do a instr(fieldname, "id") or something like that, to find it.</p>