Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Location
    Alabama
    Posts
    37

    Unanswered: [RESOLVED] Code to check query for data or null

    Access 2000
    WinXP Pro


    Greetings:

    I have a form named “current”, I also have a query that is named “month” I need code that will check the query ( “month”) and if it contains data, activate a message box that will say, “There is activity in the month files”. I need this code to be called when the form first opens up.

    Will a dlookup type code work?

    Resolution:
    If IsNull(DLookup("anyfield", "month", "")) = False then
    msgbox "There is activity in the month files:
    end if

    Thanks
    Last edited by mshelley1; 01-06-07 at 21:16.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I'd use DCount, since you just want to see if it contains data.
    Paul

  3. #3
    Join Date
    May 2006
    Location
    Alabama
    Posts
    37
    Could you give me an example of how I would format this

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Code:
    If DCount(...) > 0 Then
      Msgbox "You've got records!"
    End If
    Paul

Posting Permissions

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