Group:  Microsoft Access ยป microsoft.public.access.macros
Thread: error trying to use ADO to read table items

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

error trying to use ADO to read table items
Mike Scirocco <mscir[ at ]yahoo.com> 22.09.2006 06:09:46
I'm using Office 2000, getting run-time error 429 (activex component
can't create object) which fails on this code:

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

I'm trying to read the text in one column of each row, send that text to
a function, and then enter the result returned by the function in
another column of the same row. I was using the approach below.

I'm pretty good with VB6 but a complete beginner with Access. Is there
any way to read a table from within Access without using ADO? I mean,
are there any tricks the application provides that allows direct table
interaction?

Thanks,
Mike

Public Sub DoHostNameLookup()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
'Dim rs As Recordset
'Set rs = New Recordset
'Instantiate the Recordset -- provide memory for it on the heap
using New
'This means that you have to remember to manually release that
memory when
'you're don with the Recordset, or you'll get a memory leak
rs.Open "Select * from IPAddressList", CurrentProject.Connection
rs.MoveFirst
Do While Not rs.EOF
rs("HostName") = GetHostNameFromIP(rs("IPAddress"))
rs.Update
rs.MoveNext
Loop
Set rs = Nothing
End Sub
Re: error trying to use ADO to read table items
Mike Scirocco <mscir[ at ]yahoo.com> 22.09.2006 06:46:20
Mike Scirocco wrote:
[Quoted Text]
> I'm using Office 2000, getting run-time error 429 (activex component
> can't create object) which fails on this code:
>
> Dim rs As ADODB.Recordset
> Set rs = New ADODB.Recordset
<snip>

Sorry, I ran componenet checker and it couldn't find a valid version of
MDAC! Tried installing version 2.8 but I'm getting errors (see below),
same with 2.7 and 2.5, Safe Mode doesn't help. At least I know what the
problem is now.

Mike

Advanced INF Installer
Error registering the OCX
c:\program files\common files\system\ado\msado15.dll
c:\program files\common files\system\ole db\sqlxmlx.dll
c:\program files\common files\system\ole db\sqloledb.dll
Re: error trying to use ADO to read table items
Steve Schapel <schapel[ at ]mvps.org.ns> 23.09.2006 05:00:25
Mike,

First of all, the focus of this newsgroup is Macros in Access, and
although VBA procedures are sometimes referred to as macros in other
programs, this si not the case in Access.

I am not sure about the reason for the error you are experiencing. I
would certainly recommend using DAO over ADO, but I don't think that is
related to your problem.

However, it seems to me that you can achieve what you want here with a
simple Update Query, in other words you are doing it the hard way.
Please post back if you need more explicit help with this aspect.

--
Steve Schapel, Microsoft Access MVP

Mike Scirocco wrote:
[Quoted Text]
> I'm using Office 2000, getting run-time error 429 (activex component
> can't create object) which fails on this code:
>
> Dim rs As ADODB.Recordset
> Set rs = New ADODB.Recordset
>
> I'm trying to read the text in one column of each row, send that text to
> a function, and then enter the result returned by the function in
> another column of the same row. I was using the approach below.
>
> I'm pretty good with VB6 but a complete beginner with Access. Is there
> any way to read a table from within Access without using ADO? I mean,
> are there any tricks the application provides that allows direct table
> interaction?
>
> Thanks,
> Mike
>
> Public Sub DoHostNameLookup()
> Dim rs As ADODB.Recordset
> Set rs = New ADODB.Recordset
> 'Dim rs As Recordset
> 'Set rs = New Recordset
> 'Instantiate the Recordset -- provide memory for it on the heap
> using New
> 'This means that you have to remember to manually release that
> memory when
> 'you're don with the Recordset, or you'll get a memory leak
> rs.Open "Select * from IPAddressList", CurrentProject.Connection
> rs.MoveFirst
> Do While Not rs.EOF
> rs("HostName") = GetHostNameFromIP(rs("IPAddress"))
> rs.Update
> rs.MoveNext
> Loop
> Set rs = Nothing
> End Sub

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net