Re: DAO OpenRecordset returns... nothing?
- From: Paul Clement <UseAdddressAtEndofMessage@xxxxxxxxxxxxxx>
- Date: Fri, 07 Jul 2006 14:23:13 -0500
On 7 Jul 2006 11:47:22 -0700, "Keithius" <keithius@xxxxxxxxx> wrote:
¤ I've searched for days trying to figure this one out - I hope someone
¤ here can help me.
¤
¤ The problem, in a nutshell, is this: I've got a Recordset object and a
¤ Database object. The database is an Access MDB database that is open.
¤ The Recordset object is a brand new, just dim-ed variable. Here is the
¤ simplified code:
¤
¤ set myRecordset = myDatabase.OpenRecordset(someQuery)
¤
¤ do while myRecord.EOF = False
¤ ' do something
¤ loop
¤
¤ (Assume that "someQuery" is a valid query, but that it happens to
¤ return 0 (zero) rows from this particular database.)
¤
¤ The problem occurs at the start of the "do" loop; or more specifically,
¤ when ANY member of the "myRecord" object is accessed. The error is
¤ "object variable or with block variable not set." The problem only
¤ seems to occur if "someQuery" returns 0 (zero) rows.
¤
¤ If I'm not mistaken, when OpenRecordset returns 0 (zero) rows, it
¤ should still return a Recordset object; but it would set the .EOF
¤ property to "True." At least, that's how all the MSDN documentation
¤ seems to read.
¤
¤ I'm at a loss here - I can't figure this one out. Anyone have any
¤ ideas?
You have "myRecordset" and your loop is executed on "myRecord". Is this a typo? If not this would
most certainly explain the error message.
Paul
~~~~
Microsoft MVP (Visual Basic)
.
- References:
- DAO OpenRecordset returns... nothing?
- From: Keithius
- DAO OpenRecordset returns... nothing?
- Prev by Date: Re: DAO OpenRecordset returns... nothing?
- Next by Date: Re: Error accessign an ACCESS database
- Previous by thread: Re: DAO OpenRecordset returns... nothing?
- Next by thread: Problem with Data1.recordset.AddNew
- Index(es):
Relevant Pages
|