SubForm - Setting The Rowsource

G

Guest

I am trying to set the RowSource on a SubForm using Dynamic SQL, then to
requery it. I keep getting Application/Object Error. Why?

The code used is:

MsgBox Forms![frmServiceCreditv2].[sfrmServiceDetailsSubForm].Form!lblCol3
Forms![frmServiceCreditv2].[sfrmServiceDetailsSubForm].Form.RowSource = strSQL
Forms![frmServiceCreditv2].[sfrmServiceDetailsSubForm].Form.Requery

based on:

To refer to a control on a subform, use the following syntax:

Forms![main form name]![subform control name].Form![control name]
To refer to a control on a subreport, use the following syntax:
Reports![main report name]![subreport control name].Report![control name]
 
M

Marshall Barton

Patrick said:
I am trying to set the RowSource on a SubForm using Dynamic SQL, then to
requery it. I keep getting Application/Object Error. Why?

The code used is:

MsgBox Forms![frmServiceCreditv2].[sfrmServiceDetailsSubForm].Form!lblCol3
Forms![frmServiceCreditv2].[sfrmServiceDetailsSubForm].Form.RowSource = strSQL
Forms![frmServiceCreditv2].[sfrmServiceDetailsSubForm].Form.Requery

based on:

To refer to a control on a subform, use the following syntax:

Forms![main form name]![subform control name].Form![control name]
To refer to a control on a subreport, use the following syntax:
Reports![main report name]![subreport control name].Report![control name]


Your syntax is fine. The problem seems to be that doem
object do not have a RowSource property. perhaps you want
to use the RecordSource property??
 

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