M
Mike Scirocco
I have a large table of IP Addresses that I resolve the host names for.
There are over 300,000 entries in the table. I found the code I'm using
online, I'm okay with VB6 but I'm a beginner with Access and I'm hoping
that I can get some suggestions on how to speed up this code.
Thanks,
Mike
Dim dbsCurrent As Database
Dim qdfPassThrough As QueryDef, qdfLocal As QueryDef
Dim rs As Recordset, strMessage As String
'Open a database from which QueryDef objects can be created
Set dbsCurrent = OpenDatabase("db2.mdb")
'Create pass-through query to retrieve data from a SQL Server DB
Set qdfPassThrough = dbsCurrent.CreateQueryDef("AllTitles")
qdfPassThrough.SQL = "SELECT * FROM IPAddressList"
qdfPassThrough.ReturnsRecords = True
'Create temp QueryDef object to get data from pass-through query
Set qdfLocal = dbsCurrent.CreateQueryDef("")
qdfLocal.SQL = "SELECT TOP 5 title FROM AllTitles"
Set rs = qdfLocal.OpenRecordset()
With rs
Do While Not .EOF
If Len(rs("IPAddress")) > 0 Then
rs("HostName") = GetHostNameFromIP(rs("IPAddress"))
End If
.MoveNext
Loop
.Update
DoEvents
.Close
End With
'Delete pass-through query
dbsCurrent.QueryDefs.Delete "AllTitles"
dbsCurrent.Close
There are over 300,000 entries in the table. I found the code I'm using
online, I'm okay with VB6 but I'm a beginner with Access and I'm hoping
that I can get some suggestions on how to speed up this code.
Thanks,
Mike
Dim dbsCurrent As Database
Dim qdfPassThrough As QueryDef, qdfLocal As QueryDef
Dim rs As Recordset, strMessage As String
'Open a database from which QueryDef objects can be created
Set dbsCurrent = OpenDatabase("db2.mdb")
'Create pass-through query to retrieve data from a SQL Server DB
Set qdfPassThrough = dbsCurrent.CreateQueryDef("AllTitles")
qdfPassThrough.SQL = "SELECT * FROM IPAddressList"
qdfPassThrough.ReturnsRecords = True
'Create temp QueryDef object to get data from pass-through query
Set qdfLocal = dbsCurrent.CreateQueryDef("")
qdfLocal.SQL = "SELECT TOP 5 title FROM AllTitles"
Set rs = qdfLocal.OpenRecordset()
With rs
Do While Not .EOF
If Len(rs("IPAddress")) > 0 Then
rs("HostName") = GetHostNameFromIP(rs("IPAddress"))
End If
.MoveNext
Loop
.Update
DoEvents
.Close
End With
'Delete pass-through query
dbsCurrent.QueryDefs.Delete "AllTitles"
dbsCurrent.Close