insert query, autonumber lookup

  • Thread starter Thread starter Snuyt
  • Start date Start date
S

Snuyt

Hello,

I have a insert query in an Access database:

q="INSERT INTO tbl (f1, f2) VALUES ('1', '2')"

the table has 3 fields: id: autonumber, f2: text, f3: text

how do I retrieve the id from this query ?

This is the code I use:

cmd = New OleDb.OleDbCommand(q, MyCon)
MyCon.Open()
cmd.ExecuteNonQuery()


thanks,
Snuyt
 
Snuyt said:
Hello,

I have a insert query in an Access database:

q="INSERT INTO tbl (f1, f2) VALUES ('1', '2')"

the table has 3 fields: id: autonumber, f2: text, f3: text

how do I retrieve the id from this query ?

This is the code I use:
to be complete:

Dim MyCon As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand
 
Back
Top