Subform RecordSource Problem

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.
 
J

John Lane

Never mind. Sorry to bother everyone. I found the syntax in a couple of posts
down.
 
T

Tom van Stiphout

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
 

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