Change source in a Subform

  • Thread starter Thread starter scott
  • Start date Start date
S

scott

I am trying to change the Source Object for a subform, depending on the user
input in a prior form. I have a form that gets input from a user. If the
value chosen in that form is 1, another form opens (RequestForm) and I want
the Source Object for the subform to be BudgetData; if the value is 2 I want
the source object to be BudgetDataFlat. The relatively simple code I am
using is:

If Frame29 = 2 Then
DoCmd.OpenForm "RequestForm", acDesign
Forms!RequestForm.BudgetData.Source = "BudgetDataFlat"
End If

Access returns the message "Object doesn't support this property or method".

Suggestions?
 
Sorry for wasting anybody's time on this. Within seconds of posting I
discovered the error (needed to use SourceObject instead of Source - duh!).
 
scott said:
I am trying to change the Source Object for a subform, depending on the
user
input in a prior form. I have a form that gets input from a user. If the
value chosen in that form is 1, another form opens (RequestForm) and I
want
the Source Object for the subform to be BudgetData; if the value is 2 I
want
the source object to be BudgetDataFlat. The relatively simple code I am
using is:

If Frame29 = 2 Then
DoCmd.OpenForm "RequestForm", acDesign
Forms!RequestForm.BudgetData.Source = "BudgetDataFlat"
End If

Access returns the message "Object doesn't support this property or
method".

Suggestions?

You don't specify the name of the subform control on RequestForm, so here
I'll call it SubName. You'll need to replace that with your actual control
name.

Forms!RequestForm.SubName.SourceObject = "BudgetDataFlat"
 
Back
Top