Incorrect number of records showing in a datasheet form (1 Viewer)

InFlight

User
Local time
Tomorrow, 05:52
Joined
Jun 11, 2015
Messages
130
When i run this code i only get 7 records but the debug.print tells me there are 8 records
If i run the query and use the text filter i get 8 records



Code:
Private Sub cmdAncestors_Click()
    Dim strWhere As String
    
    If Nz(TempVars!vBirdID, 0) = 0 Or TempVars!vBirdID = "" Then Exit Sub
        
    strWhere = "RingNo = '" & TempVars!vBirdID & "'"
    Debug.Print DCount("*", "qry_AncestorDetails", strWhere) & ",  " & strWhere
    
    If DCount("*", "qry_AncestorDetails", strWhere) = 0 Then
        MsgBox TempVars!vBirdID & " has no Ancestors in the DataBase.", vbInformation, "No Ancestors"
    Else
        DoCmd.OpenForm "frm_AncestorDetails", acFormDS, , strWhere, acFormReadOnly
    End If

End Sub
 

CJ_London

Super Moderator
Staff member
Local time
Today, 16:52
Joined
Feb 19, 2013
Messages
16,553
Not sure what your question actually is but just a guess - perhaps either your form does not use the same query or it has a filter set which is excluding one of them. Have you tried with a different strWhere?
 

Isaac

Lifelong Learner
Local time
Today, 09:52
Joined
Mar 14, 2017
Messages
8,738
Or your tempvar is changing.
 

InFlight

User
Local time
Tomorrow, 05:52
Joined
Jun 11, 2015
Messages
130
Not sure what your question actually is but just a guess - perhaps either your form does not use the same query or it has a filter set which is excluding one of them. Have you tried with a different strWhere?
yes, i tried without the strwhere and still got the same result
Just noticed that 1 of the birds is repeated and 2nd one is not shown
 

vhung

Member
Local time
Today, 09:52
Joined
Jul 8, 2020
Messages
235
seems the filter codes responded to
> the zero value or null field
 

onur_can

Active member
Local time
Today, 09:52
Joined
Oct 4, 2015
Messages
180
The filter you added affects your Query Result. To be sure, remove the filter or try replacing the filter.
 

Users who are viewing this thread

Top Bottom