Results 1 to 3 of 3
  1. #1
    boboivan is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Dec 2015
    Posts
    65

    Display all the lookup values found


    Hi!

    I have this code that finds, counts and warns me about the existing of null values in a query field:
    Code:
    Private Sub Form_Load()
    Dim seepp As String
    Dim countpp As String
    
    countpp = DCount("QueryField1", "QueryName", "IsNull([QueryField2])")
        
    If countpp <> 0 Then
    seepp = DLookup("QueryField1", "QueryName", "IsNull([QueryField2])")
    Me.txbWarning.Value = "You have " & countpp & " null values" & "for " & seepp
    End If
    End Sub
    If there is more than one null values found, I'd like to see in my warning texbox all the null values found in QueryField1 (which are displayed as id number, not text, as I'd like - another issue, but not important), like 1, 4, 5, 7, ... or textFormat1, textFormat2, ...
    I'm guessing that seepp value marked with red color should be improved, but I have no idea how.

    Thx!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    Why not just open the query of values that are null, and show the user?

    countpp = DCount("QueryField1", "QueryName", "[QueryField2] is null")
    if countpp>0 then docmd.openquery "qsNullVals"

  3. #3
    boboivan is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Dec 2015
    Posts
    65
    Thank you ranman for your input!
    This is the easiest way to do it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-28-2015, 12:38 PM
  2. Replies: 4
    Last Post: 07-28-2015, 10:14 AM
  3. Replies: 3
    Last Post: 10-23-2013, 01:32 PM
  4. Replies: 7
    Last Post: 08-24-2012, 04:08 PM
  5. Replies: 8
    Last Post: 11-04-2011, 06:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums