Subform not displaying records

A

Allen Davidson

Hi I'm a bit stumped on this one.

I have a subform to display people (FirstName, LastName) The subforms record
source is set to SELECT * FROM qryRespondent.

I want to filter the subform from the mainform so I have code to change the
SQL statement. Problem is the subform does not then show any records.

Code is

Private Sub cmdSave_Click()

Dim strSQL As String

strSQL = "SELECT * FROM tblRespondent "

Me.subSelectedRespondent.Form.RecordSource = strSQL

Me.subSelectedRespondent.Form.Requery


End Sub

subSelectedRespondent is the name of the subform control.

If I dont run this code the subfoerm does showe records. If I chnage the SQL
in the code to point to a table without Firstname, LastName then the subform
displays two columns with #name? in each.

Any ideas? I have similar code working fine elsewhere.

Allen
 
A

Allen Davidson

Doh

Changed the SQL to read Select FirstName, LastName from qryRespondent and it
works fine.

Something to do with binding???

Allen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top