Hi Shawn,
Set datCompanyNumber = null
couldn't have worked because you don't set a reference to null, but to Nothing, so try this instead:
Set datCompanyNumber = Nothing
Greets,
Romek
> -----Original Message-----
> From: Gamble, Shawn [mailto:Shawn_Gamble@S...]
> Sent: Tuesday, October 03, 2000 7:58 PM
> To: professional vb
> Subject: [pro_vb] Re: DAO code
>
>
> Sorry neither of these work. The "Null" is an invalid use of
> property and
> the close isn't a property of the plane jane data control. Shawn
>
> -----Original Message-----
> From: b_rajesh@c... [mailto:b_rajesh@c...]
> Sent: Monday, October 02, 2000 1:01 PM
> To: professional vb
> Subject: [pro_vb] Re: DAO code
>
>
> Hi Shawn Gamble,
>
> please write this code in the begining of the clik event
>
> On Mon, 02 October 2000, "Gamble, Shawn" wrote:
>
> datCompanyNumber.close
> or
> set datCompanyNumber=null
>
> because ur opening another recordset to the existing one.
> because of this ur
> getting the problem
>
> Bye
>
> Rajesh
>
>
> >
> > I know I must be brain dead today but I'm having trouble
> returning a DAO
> > recordset. "Yes Virginia I have to use DAO. I'm using the
> following code
> on
> > the on_click event of a combobox.
> >
> > Dim vntTemp
> > datCompanyNumber.Connect = GblStrConnect
> > datCompanyNumber.DatabaseName = GblStrDbName
> > datCompanyNumber.RecordSource = "SELECT Company_number FROM
> > vCompanies Where Name = '" & cboCountries.Text & "'"
> > datCompanyNumber.Refresh
> >
> > Do While Not datCompanyNumber.Recordset.EOF
> > vntTemp = datCompanyNumber.Recordset!company_number
> > If IsNull(vntTemp) Then vntTemp = ""
> >
> > datCompanyNumber.Recordset.MoveNext
> > Loop
> >
> > 'Retrieve the company number from the company view
> > datCompanyNumber.RecordSource = "Company"
> > datCompanyNumber.RecordsetType = vbRSTypeTable
> > datCompanyNumber.Recordset.MoveFirst
> >
> > This works great until the combo box is clicked a second
> time. Then it
> bombs
> > out on the "datCompanyNumber.Refresh" and says Invalid
> Operation. Overall
> I
> > have a combo box with a list of company names. When the
> user clicks the
> > combobox I want to retrieve that companies number for
> future use. Any
> idea's
> > and thanks in advance.
> >
> > Shawn Gamble
> >
> >
>