Kira
Registered User.
- Local time
- Today, 04:19
- Joined
- Jul 7, 2008
- Messages
- 40
I have a macro that i have set to run at the opening of my database that is supposed to display the number of items that need to be reordered. Only problem is that when it tries to run it says it can't find the input table or query. Here is my code:
The record source is from a reorder report I have. Can this not be done? I don't actually have a table or query that only lists items that need to be reordered.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim x As Integer
Dim MyQuery As String
MyQuery = "SELECT [Inventory Stock Levels].* FROM [Inventory Stock Levels] WHERE ((([Inventory Stock Levels].[Current Stock])<nz([Reorder Level])));"
x = DCount("[Current Stock]", MyQuery)
If x Then
MsgBox "There are " & x & " items that need to be reordered!!!!!!!"
'Or you can take them right to the screen or report.
End If
End Sub