On my access Forms I have little list boxes that display various information about the data each has a refresh button that updates the rowsource but a couple of them take about 25 seconds to execute and I was trying to get the label to change colour to show it is doing something and revert back again when it is done, but I'm finding that they change colour in millisecinds and the sql statement is running in the background still....
===========================================================
===========================================================
Code:
Private Sub RefreshOutOfStocksButton_Click()
Me.OutofStocksLabel.BackColor = 65280
Select Case Len(Me.OutOfStocks.RowSource)
Case 0
Let Me.OutOfStocks.RowSource = "SELECT TOP 100 PERCENT STK_STOCK_2.STK_SANALYSIS10 AS Analysis, STK_LOCATION.LOC_STOCK_CODE AS Stock_Code, STK_STOCK3.STK_USRNUM1 AS ADS, STK_STOCK3.STK_NUM1 AS TREND, VIEW_Sales_Last30Days.Qty AS Last30 FROM SL_ANALYSIS INNER JOIN STK_STOCK_2 ON SL_ANALYSIS.SACODE = STK_STOCK_2.STK_SANALYSIS10 INNER Join STK_LOCATION ON STK_STOCK_2.STKCODE2 = STK_LOCATION.LOC_STOCK_CODE INNER Join STK_STOCK3 ON STK_STOCK_2.STKCODE2 = STK_STOCK3.STKCODE3 LEFT OUTER Join VIEW_Sales_Last30Days ON STK_STOCK_2.STKCODE2 = VIEW_Sales_Last30Days.SM_STOCK_CODE WHERE (STK_LOCATION.LOC_PHYSICAL = 0) AND (STK_STOCK_2.STK_SANALYSIS10 IN ('10115', '10112')) AND (STK_LOCATION.LOC_CODE = 'free') ORDER BY STK_STOCK_2.STK_SANALYSIS10, STK_LOCATION.LOC_STOCK_CODE"
Case Else
Let Me.OutOfStocks.BoundColumn = Me.OutOfStocks.BoundColumn
End Select
Me.OutofStocksLabel.BackColor = 10079487
End Sub