The same logic should work for either one:
Function find_identity_or_autonumber(my_table As String) As String
Dim db As DAO.Database, tdf As DAO.TableDef, fld As DAO.Field
Set db = CurrentDb
Set tdf = db.TableDefs(my_table)
For Each fld In tdf.Fields
If (fld.Properties("Attributes") And dbAutoIncrField) = dbAutoIncrField Then
find_identity_or_autonumber = fld.Name
Exit For
End If
Next fld
Set tdf = Nothing
Set db = Nothing
End Function