baldeagle
Registered User.
- Local time
- Today, 15:42
- Joined
- Nov 9, 2004
- Messages
- 38
Howdy,
I am attempting to create a module that will return true if the two passed values are present in a table.
Basically this stop a.sinatra's workday function from removing certain dates. This could run many times per a calculation, and I need to minimize the time it takes to complete (Hence no D*** disfunctions).
I am attempting to create a module that will return true if the two passed values are present in a table.
Code:
tblStaurdays
------------
workorder
WorkDate
Code:
Option Compare Database
Option Explicit
Function fWorkWeekend(Workodr As Integer, Wdate As Date) As String
Dim rst As New ADODB.Recordset
rst.Open "tblSaturdays", CurrentProject.Connection
Dim strSQL As String
strSQL = "Select WorkOrder from tblSaturdays Where [workorder]='" & Workodr & "' And [workdate]= '" & "#" & Wdate & "#" & "'"
rst.Open strSQL, CurrentProject.Connection, adOpenStatic, adLockOptimistic, adCmdText 'static,optimistic,adcmdtext
If rst.EOF Then
fWorkWeekend = "no"
Else
fWorkWeekend = "yes"
End If
rst.Close
Set strSQL = Nothing
Set rst = Nothing
End Function
Basically this stop a.sinatra's workday function from removing certain dates. This could run many times per a calculation, and I need to minimize the time it takes to complete (Hence no D*** disfunctions).
Last edited: