Re: DAO peculiarity in A97?
- From: jacksonmacd <jackMACmacdo0nald@xxxxxxxxx>
- Date: Sat, 31 Dec 2005 15:15:36 GMT
I usually use this construct for DAO loops, including A97
Set rs = db.Openrecordset (....)
do while not rs.eof
[...]
rs.movenext
loop
It handles the no-record condition appropriately, without using a
GoTo. Your code uses .BOF to check for no records, which may not be
correct.
On Sat, 31 Dec 2005 09:02:01 -0500, MLH <CRCI@xxxxxxxxxxxxxx> wrote:
>I have noticed, in the following code snippet, that if
>tblCorrespondence has no records in it, I get an error
>91 later during processing. It complains that an object
>variable or a With block variable has not been set. I
>have checked the code carefully and I don't think this
>is the case. I'm wondering if my code in line 231 might
>be flawed in light of the fact that qdfType17CorrespRecs
>returns no records?
>
>140 With MyDB
>170 Set qdfType17CorrespRecs = .CreateQueryDef("", "Select *
>FROM tblCorrespondence;")
>180 With qdfType17CorrespRecs
>210 ' Open Recordset from QueryDef.
>220 Set rstType17CorrespRecs =
>.OpenRecordset(dbOpenSnapshot)
>230 ' With rstType17CorrespRecs
>231 ' If .BOF = True Then GoTo NoRecs
>240 ' .MoveFirst
>250 ' Do Until rstType17CorrespRecs.EOF
**********************
jackmacMACdonald@xxxxxxxxxxxxxx
remove uppercase letters for true email
http://www.geocities.com/jacksonmacd/ for info on MS Access security
.
- References:
- DAO peculiarity in A97?
- From: MLH
- DAO peculiarity in A97?
- Prev by Date: Re: DAO peculiarity in A97?
- Next by Date: Importing Text File that is vertically oriented
- Previous by thread: Re: DAO peculiarity in A97?
- Next by thread: Re: DAO peculiarity in A97?
- Index(es):