Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    When the query is not filled in (Access 2000)

    How can i check whether a query is Null and give a message? My query is called "qryVaStockFlow" . If the query is null, that is not filled in, the message box should call the attention.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: When the query is not filled in (Access 2000)

    What do you mean by "a query is Null"? A query returns records, and the records may or may not contain null values, but I don't know what "a query is Null" means.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: When the query is not filled in (Access 2000)

    Thank you for the reply. Sorry for my expressions,i didnt find the right words..What i mean is the case when there will no be any entries in the tables underlying the query.I think the word is empty. This is the case when there are no entries for example orders and the query does not show anything. I just want to send a signal that the query is empty. This does not mean that there is an error, just to tell that the query is empty.

    Kind regards

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: When the query is not filled in (Access 2000)

    You can use the DCount function to find the number of records returned by the query. If this is 0, the query is "empty":

    If DCount("*", "qryVaStockFlow") = 0 Then
    ' Query returns no records
    MsgBox "There are no records to be displayed", vbInformation
    Else
    ' Code to open a form or whatever you want to do goes here
    ...
    End If

  5. #5
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: When the query is not filled in (Access 2000)

    Thank you Hans !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •