Setup Task Scheduler using MS Access VBA

If User wants to perform some action repeatedly than Task Scheduling is one of the best option that can be used for this purpose in Microsoft Access. This article assumes that its users have prior knowledge of VBA. MS Access VBA provides some sort of VBA Automation. Now in order to complete this requirement first we need to create a form named frmScheduledTime some controls over it. As shown in figure below.

Setup Task Scheduler using MS Access VBA Fig 1.1

Fig 1.1

As shown in above figure form contains three different labels. Here labels have been used for purpose of information only.

After creating form, now creating a table named tblurlNames as shown in figure below.

Setup Task Scheduler using MS Access VBA Fig 1.2

Fig 1.2

As shown in figure Fig 1.2 this table will include only one field for storing URL names. Objective of this article to perform task Scheduling is to perform some activity repeatedly (Regular Interval of time). In this article action will be to display URL Details in regular time interval. URL Details involves acDisplayedValue , acDisplayText , acAddress , acSubAddress , acScreenTip , acFullAddress. We use HyperLinkPart method and HyperlinkPart method returns information about data stored as a Hyperlink data type String. In this article we are considering repeated action is to enumerate all Hyperlink details after time period of 5 Sec.

Setup Task Scheduler using MS Access VBA Fig 1.3

Fig 1.3

VBA Code:-

Private Sub Form_Open(Cancel As Integer)
Me.lbltwo.Visible = True
End Sub

Private Sub Form_Timer()
Me.lbltwo.Visible = False
Me.lblThree.Visible = False
ShowHyperlinkParts "tblurlNames", "urlNames"
End Sub

Public Sub ShowHyperlinkParts(ByVal strTable As String, ByVal strField As String)
Dim rs As New ADODB.Recordset
Dim strMassg As String
rs.Open strTable, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly

Do Until rs.EOF
strMassg = "DisplayValue = " _
& HyperlinkPart(rs(strField), acDisplayedValue) _
& vbCrLf & "DisplayText = " _
& HyperlinkPart(rs(strField), acDisplayText) _
& vbCrLf & "Address = " _
& HyperlinkPart(rs(strField), acAddress) _
& vbCrLf & "SubAddress = " _
& HyperlinkPart(rs(strField), acSubAddress) _
& vbCrLf & "ScreenTip = " _
& HyperlinkPart(rs(strField), acScreenTip) _
& vbCrLf & "Full Address = " _
& HyperlinkPart(rs(strField), acFullAddress)

MsgBox strMassg
Set rs = Nothing
End Sub


It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. Access Guru will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.