Error! table or Query does not Exist

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:

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
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.
 
1) Dont use spaces in table/column names
2) Use a naming convention, meaning every table should have a prefix tbl and a form frm query qry etc.
3) If you are trying to query a report... no that is not possible this way...

Good luck....
 
here it is. If you notice any other flaws please feel free to let me know! ;p
 

Attachments

Hi Kira,

I don't have 2007 at work. I posted a correction in your other thread...did that fix the problem?
 

Users who are viewing this thread

Back
Top Bottom