Results 1 to 2 of 2

Thread: Unique ID

  1. #1
    Join Date
    Feb 2002

    Question Unanswered: Unique ID

    Hi folks:
    Is there a way to select the current id being generate when a row is insert in the table. Say the id is autonumber which was generated with insert statement needs to be displayed.

    In Oracle usually SELECT seq_abc.currval will return the current value of the sequence.

    Once the entry has been made I need to use the same ID as a foreign key in another table.

    Any comments or suggestions are welcome.

    Thanks! in advance.

  2. #2
    Join Date
    Nov 2001

    I usually use Jet engine to do this sort of work.

    dim rst as dao.recordset
    dim strSQL as string
    dim lngNewKey as long

    strSQL = "Select * From tblTable Where False;"
    set rst = currentdb.openrecordset(strSQL,dbopendynaset)

    lngNewKey = rst.MyAutoNumberField
    ' now you can use lngNewKey in the application, for example use it
    ' as a foreign key in another table.
    set rst = nothing


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts