Results 1 to 5 of 5

Thread: Just one DB question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    Question

    Hello!

    I have kind an annoying problem .
    The thing is that I have in my DB table field which is AutoNumber. And in that table I add another record. Is there any other way to retrieve that field's value without loading whole recordset, because I need that number for adding it to other records in some other tables that are referencing to just added record.
    Any suggestions?
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    zvonko.bostjancic@siol.net
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  2. #2
    Guest

    try this:

    Code:
    dim db as database
    dim rs as recordset
    dim num as long
    
    set db = opendatabase("my database")
    set rs = db.openrecordset("my table")
    
    if not rs.eof then
    rs.movelast
    num = rs.field
    
    set rs = nothing


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Yes, but I still have to reopen recordset.
    I'd like to know if there is any way to retrieve field value without reloading whole recordset.
    Any ideas?
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    zvonko.bostjancic@siol.net
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Oh, I forgot to tell: I'm using DataEnvironment
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    zvonko.bostjancic@siol.net
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  5. #5
    Guest
    perhaps run a query on that field only
    and have it return one record in a
    descending order, this will give you the last
    record

Posting Permissions

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



Click Here to Expand Forum to Full Width