Sometimes when I piece together code from the many generous examples available, it works magic which I don't completely understand. This is one of those examples.

I have a REALSQLDatabase with a table called "Names"
The fields are:
StudID: Integer Primary Key
StudFirst: VarChar
StudLast: VarChar
StudPW: VarChar
ClassNm: VarChar

 To create a new entry I use this code:

 rs = App.QMPdata.SQLSelect("SELECT MAX(StudID) FROM Names")

  // Create Database Record
  rec = New DatabaseRecord

  rec.Column("StudFirst") = firstNm
  rec.Column("StudLast") = lastNm
  if pw <> "" then
    rec.Column("StudPW") = scrambleStr(pw)
  else
    rec.Column("StudPW") = pw
  end
  rec.Column("ClassNm") = theCl

  // Insert Record Into table "Names" of the Database
  App.QMPdata.InsertRecord "Names", rec
App.QMPdata.commit

Like "magic" the StudID field contains the next available integer. But now I want to get the last StudID created and I don't know how to retrieve it.
seeVal = rs.field("StudID") causes a nil obj error
seeVal = rec.Column("StudID") yields nothing

How can I retrieve that value?

TIA



Roger M. Clary
Class One Software
http://www.classonesoftware.com
[EMAIL PROTECTED]

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to