Click to See Complete Forum and Search --> : Link checker


Astaroth
March 15th, 2001, 05:56 PM
ok, i am a complete new comer to VB other than playing with it in ASP pages, but i was wondering how hard it would be to write a short program which would connect to a (possibly remote) access database, check that all urls in a column are still active and remove the rows containing any dead links, after checking them 2 or 3 times??

robby bassic
March 16th, 2001, 12:53 AM
'Reference: Microsoft ActiveX Data Objects 2.5 Library

'//////////Place this section at top of form
Private WithEvents rsADOSetRecord As ADODB.Recordset
Private adoDataGrid As ADODB.Connection
'/////////////
Private Sub Command1_Click()
Set adoDataGrid = New ADODB.Connection
Set rsADOSetRecord = New ADODB.Recordset
Dim TempURL as string

With adoDataGrid
.CursorLocation = adUseClient
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "c:\FileName.mdb", "admin", ""
End With
With rsADOSetRecord
.Open "SELECT FieldName FROM TableName", adoDataGrid, adOpenStatic, adLockOptimistic, adAsyncFetch
If Not .BOF Then
.MoveFirst
Do While Not .EOF
TempURL=!FieldName
'//here you can send the "TempURL" to a routine that will go on line and test its' validity.
.MoveNext
Loop
End If
.Close
End With
End Sub

* FieldName,TableName,FileName should all be replaced with your own names.