Re: Object variable or With block variable not set
- From: "Alastair MacFarlane" <AlastairMacFarlane@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 20 Oct 2005 02:34:02 -0700
Larry,
Thanks again and bottom of the class for Alastair. Fancy setting the return
to nothing before returning the values. I must of done a basic Recordcount
within the function and convinced myself that the problem was not in the
function.
Thanks again.
Alastair MacFarlane
"Larry Lard" wrote:
>
> Alastair MacFarlane wrote:
> > Dear All,
> >
> > Can someone please explain why I get the error at the line rsTemp.MoveFirst
> > in the FillListBox() sub I get the error:
> >
> > ?err.Number
> > 91
> > ?err.Description
> > Object variable or With block variable not set
> >
> > Which I understand what it means but not why? I have declared the Recordset
> > properly (I think). I have a sub that calls a function that returns the data.
>
> Sure? :)
>
> > I have checked this and it works fine.
>
> > Public Function GetDataMail() As ADODB.Recordset
> > Dim db As ADODB.Connection
> > Dim adoPrimaryRS As ADODB.Recordset
> > Set db = New Connection
> > db.CursorLocation = adUseClient
> > db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=\\sql01\Mail.mdb;"
> > Set adoPrimaryRS = New Recordset
> > adoPrimaryRS.Open "select EMail,MailID,Name from EMail", db, adOpenStatic,
> > adLockOptimistic
> > Set adoPrimaryRS = Nothing '**
> > Set db = Nothing
> > Set GetDataMail = adoPrimaryRS '**
> > End Function
>
> >From this it looks very much as if GetDataMail will always return
> Nothing, since adoPrimaryRS will always be Nothing when assigned to
> GetDataMail.
>
> Swap round the two lines I have marked ** and see how that goes.
>
> --
> Larry Lard
> Replies to group please
>
>
.
- References:
- Object variable or With block variable not set
- From: Alastair MacFarlane
- Re: Object variable or With block variable not set
- From: Larry Lard
- Object variable or With block variable not set
- Prev by Date: Re: Object variable or With block variable not set
- Next by Date: Re: Printing Blank lines for Top margin
- Previous by thread: Re: Object variable or With block variable not set
- Next by thread: Re: Object variable or With block variable not set
- Index(es):
Relevant Pages
|