Subform RecordSource Problem

  • Thread starter Thread starter John Lane
  • Start date Start date
J

John Lane

I have an Access 2007 form, with the following code in it:
Dim SQL As String

SQL = " SELECT ac_ClientAddresses.* FROM ac_ClientAddresses "
SQL = SQL & "WHERE (((ac_ClientAddresses.[Client Name]) Like '"
SQL = SQL & Me![Name] & "')); "

Forms![frmClientAddresses].Form![subfrmClientAddresses].RecordSource = SQL

Forms![frmClientAddresses].Form![subfrmClientAddresses].Requery

When the RecordSource line executes, I get a message saying the "object
doesn't support this property or method". What am I doing wrong? Thanks.
 
On Sun, 29 Mar 2009 10:00:04 -0700, John Lane

Either frmClientAddresses is not the name of an open form, or
subfrmClientAddresses is not the name of a subform control (note: NOT
the subform's controlsource).

The Requery line is not needed. Setting the RecordSource property
automatically queries the underlying data.

-Tom.
Microsoft Access MVP
 
Back
Top