Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function GetHrsOfOper(sResource As String, dDateIn As Date)
Dim sConn As String, sSQL As String
Dim rst As ADODB.Recordset, cnn As ADODB.Connection
Dim sPath As String, sDB As String
Dim sPrevCC As String, BCC As Boolean
sPath = "\\bhdfwfp426.bh.textron.com\M_Ctr$\1_Supply Chain\FP\Procedures\NewAdmin"
sDB = "APS UNIVERSE"
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sPath & "\" & sDB & ".mdb;"
Set rst = New ADODB.Recordset
sSQL = "SELECT (1-TypeValue)*24 "
sSQL = sSQL & "FROM Resource_calendar_data "
sSQL = sSQL & "WHERE Resource Like '" & sResource & "%'"
sSQL = sSQL & " AND #" & Format(dDateIn, "mm/dd/yyyy") & "# >=FromDate"
sSQL = sSQL & " AND #" & Format(dDateIn, "mm/dd/yyyy") & "# <=ToDate"
With rst
.Open sSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText
On Error Resume Next
.MoveFirst
If Err.Number = 0 Then
GetHrsOfOper = rst(0)
Else
GetHrsOfOper = 24
End If
.Close
End With
cnn.Close
Set rst = Nothing
Set cnn = Nothing
End Function