I'm not very familiar with using subforms, and can't figure this one out. I've got a datasheet subform on a search form. I have the user enter a value for donor_id and click a search button. On the click event for the search button, I do this:
strSearch = Me.txtDonorID.ValuestrSQL = "SELECT Donor.* FROM Donor Where DONOR_ID = '" & strSearch & "'"Me.SubDonorList.Form.RecordSource = strSQLMe.SubDonorList.Form.Requery
The very first DONOR_ID in the table is 1, and there are two records with that ID. When I search for a donor ID of 1, it correctly populates the subform with the two records. When I search for any other donor ID in the table, the subform is empty. I've stepped through the code and confirmed that I've got the right variables at each line, and I've tried pasting the SQL command (strSQL) into a query, with donor IDs of varying lengths. It works fine. So I'm pretty confident that the code, quotes, etc, are correct.
I've also tried this, which gave the same results. Datasheet is populated if the donor ID =1 , not if it's any other string.
Since I'm kind of new to subforms, I'm assuming that that's where my problem is. I've gone through the properties over and over again, and I'm not seeing it. Does anyone recognize this issue? Thanks so much!