Hi, I was wondering if anyone could help with the following method. It seems very slow, and I am calling it from the timer. It has to open some access window to process the function and I wouldn't think a dlookup or dcount would take so long.
Is this efficient or can it be modified to be faster? thank you
Code:
Public Sub updateStatuses()
Me.lbl_StorageLastReviewedOn.Caption = ""
'Dim notInvoicedCount As Integer
'notInvoicedCount = DCount("jobId", "qryNOTINVOICEDPARENT", "")
'Dim storageLastReviewedOn As Date
'storageLastReviewedOn = Format(DLookup("value", "tbl_CONSTANT", "constantType='Storage Reviewed Last On'"), "mm/dd/yyyy")
Dim storageItemsCount As Integer
storageItemsCount = DCount("job", "qryStorageCommodities", "Status='Storage'")
'If notInvoicedCount > 0 Then
' Me.lbl_StorageLastReviewedOn.Caption = Me.lbl_StorageLastReviewedOn.Caption & "Jobs/Loads Require Billing: " & notInvoicedCount
'End If
'If DateDiff("d", Format(storageLastReviewedOn, "yyyy/mm/dd"), Format(Now(), "yyyy/mm/dd")) >= 14 Then
' Me.lbl_StorageLastReviewedOn.Caption = Me.lbl_StorageLastReviewedOn.Caption & _
' IIf(Nz(Me.lbl_StorageLastReviewedOn.Caption, "") = "", "", " ") & _
' "Items In Storage: " & storageItemsCount & " " & _
' "Storage: Last Reviewed On " & Format(storageLastReviewedOn, "mm/dd/yyyy")
'End If
If Me.lbl_StorageLastReviewedOn.Caption = "" Then
Me.lbl_StorageLastReviewedOn.Visible = False
Else
Me.lbl_StorageLastReviewedOn.Visible = True
End If
End Sub
Is this efficient or can it be modified to be faster? thank you