From: WittyGirl on
"WittyGirl" wrote:

> I went in to the Immediate Window and found that:
> "? Forms!frmCustomer!frmSubSearchResults.Form.RecordSource"
> gives the correct SQL ("SELECT DISTINCTROW tblCustomer.* FROM tblCustomer
> Where ((cuFirstName LIKE 'Kent*')) Order By cuLastName, cuFirstName;") but
> "? Forms!frmCustomer!frmSubSearchResults.Form.Recordset.RecordCount" gives
> zero records.

I have solved the problem. In doing some searching, I ran across another
forum post
(http://www.accessmonster.com/Uwe/Forum.aspx/access-formscoding/51907/Access-2007-Recordsource-Subform)
where a user named Bruce ("Datasmith") said the following:

>What I found was that when programmatically assigning the subform
>recordsource it was also assigning values to the LinkMasterFields and
>LinkChildFields properties, even though none existed to start. Now every
>time I need to reassign the recordsource I also add two statements to clear
>the relational linkage:

>Forms!frmMain!fsubTemp.Form.Recordsource = "MyQuery"
>Forms!frmMain!fsubTemp.LinkChildFields = ""
>Forms!frmMain!fsubTemp.LinkMasterFields = ""

I used the Immediate Window to verify that the form indeed had values for
master and child linked fields. Then I added the lines to my code, and it was
fixed.
From: WittyGirl on
When I enter criteria into the main form and click the Search button, the
subform goes blank and pops up a msgbox saying zero records were found.

I went in to the Immediate Window and found that:
"? Forms!frmCustomer!frmSubSearchResults.Form.RecordSource"
gives the correct SQL ("SELECT DISTINCTROW tblCustomer.* FROM tblCustomer
Where ((cuFirstName LIKE 'Kent*')) Order By cuLastName, cuFirstName;") but
"? Forms!frmCustomer!frmSubSearchResults.Form.Recordset.RecordCount" gives
zero records.

Why aren't the records there?