Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ADODB Recordset - memory like a fish (Access 97 SR2)

    A colleague has an ADODB Recordset that won't seem to stay in memory.
    The table is linked to an SQL table and its quite complex (lots of fields), could it be that its too complex to use Select * from? Is there some sort of memory buffer with recordsets?

    ADOcn.Open DSN, UID, pwd
    ScheduleReportRec.ActiveConnection = ADOcn
    str = "Select * from tblScheduledReports where ScheduledReportId =" & ScheduledReportId
    ScheduleReportRec.Open str

    If Not ScheduleReportRec.EOF Then ' report clause start
    ScheduleReportRec.MoveFirst

    'It remembers the recordset until here and then loses it when the next line is run
    str2 = ScheduleReportRec.Fields("AudienceSQL")

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: ADODB Recordset - memory like a fish (Access 97 SR2)

    What do you mean "loses it"? Is the recordset object no longer there, does it not recognize the field, or what? The default recordset in ADO is forward only, so your problem may be MoveFirst, but since you didn't tell us what error you got, it's hard to tell. Also, with an ADO recordset, you need to check for Not EOF and Not BOF because they don't behave like DAO recordsets, where an EOF alone tells you there are no records.
    Charlotte

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Recordset - memory like a fish (Access 97 SR2)

    Sorry, not being very descriptive today, but I think you've answered the question anyway.

    By lose it I meant that the variable holding the recordset does so for the first part of the code and is then empty when it gets further down, even though the variable hasnt been replaced or purposefully emptied. There isnt a specific error as the code works, it just seems to empty the variable half way through the code. However, neither me nor the colleague who initially asked me the question realised that the default for a recordset in ADO is set to forward only. After specifying the parameters the variable contains the data it should and it works perfectly.
    Thank you very much Charlotte.

Posting Permissions

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