I have the following code:
Private Sub Go_to_Link_Click()
On Error GoTo err_Go_to_Link_Click
Application.FollowHyperlink [Forms]![frmMain_Menu]![subfrmRouting_Instructions]![TxtWebsite]
Exit_Go_to_Link_Click:
Exit Sub
err_Go_to_Link_Click:
MsgBox "Error Number: " & Err.Number & vbCrLf & "Error Description: " & Err.Description & vbCrLf & vbCrLf & "Shipping Website address is invalid, please inform customer service so they can update the URL in the routing guide"
Dim rs As DAO.Recordset
Dim freight_pack As String
Dim Account_No As String
Account_No = [Forms]![frmMain_Menu]![ComboAcctNum]
freight_pack = [Forms]![frmMain_Menu]![ComboFreight_Packages]
Set rs = CurrentDb.OpenRecordset("tblInvalid_URLs")
rs.AddNew
rs("Acct_Number") = Account_No
rs("Shipping_Type") = freight_pack
rs("Invalid_Shipping_Website_Link") = [Forms]![frmMain_Menu]![subfrmRouting_Instructions]![TxtWebsite]
rs("Date_detected") = Now()
rs.Update
Resume Exit_Go_to_Link_Click
End Sub
Essentially what is happening here is there is a main form where the user selects the account number and ship type. these selections then populate a subform that contains all the shipping data needed for a specific account number and shipping type (freight or parcels).
On the subform, the user clicks a button to open a hyperlink that takes them to the required shipping website (fedex.com, ups.com, etc...). If the hyperlink is bad and triggers an error then it informs the user, and adds the accountnumber, shipping type, URL (that triggered error), and the current date to a log table so that people can run a report to see which URLs need updating.
I was curious, is it possible to loop through all the URLs in my main table to check if the hyperlinks are valid without actually opening each hyperlink? I essentially want to log all the bad URLs in one go vs logging them individually as our shipping guys encounter them so that I can generate a report and send it to the powers that be who are responsible for updating the URLs and what not.