Update RowSource In Subform

robertbwainwright

Registered User.
Local time
Today, 01:20
Joined
May 2, 2012
Messages
62
I would like to update the SQL for a subform. I have an SQL statement that I have placed into a string and now I would like to update the subform using it's RowSource property, but I get an error when trying to use the following statement:

Forms![frmModelSales].[frmModelSales-Subform-
QuestionableShip].RowSource = strSqlForSummary

(the message board has split this into two lines, it is really one)

thanks for any help!

Robert
 
I would like to update the SQL for a subform. I have an SQL statement that I have placed into a string and now I would like to update the subform using it's RowSource property, but I get an error when trying to use the following statement:

Forms![frmModelSales].[frmModelSales-Subform-
QuestionableShip].RowSource = strSqlForSummary
Where are you changing it from ? Referring to a subform you need to refer to the control on the parent form that is where the subform really is displayed. You don't refer to the subform name but that control name. So if your subform control name is Child3 and your subform is named frmModelSales-Subform-QuestionableShip (and I would not use dashes in names as that can be misinterpreted by Access. Underscores or CamelCase) you would refer to it like

Forms!frmModelSales.Child3.Form.RowSource = strSQLForSummary

Or if the code is on that main form

Me.Child3.Form.RowSource

And the .Form. part stays in there just as written. You don't change that part at all.
(the message board has split this into two lines, it is really one)
You can solve that by using the code tags here on the board.
 
Thanks SOS, I actually solved it on my own. Here is my solution:

Forms![frmModelSales]![frmModelSales-Subform-QuestionableShip].Form.RecordSource = strSqlForSummary

One of the problems was exactly as SOS suggested, the other was I was using RowSource and not RecordSource.
 

Users who are viewing this thread

Back
Top Bottom