Change textbox on subform from mainform combo box RRS feed

  • Question

  • I know there are perhaps hundreds of "reference" posts, but having tried almost all I can find for about three days, I am asking for help. Here is the code:

    If Me.Frame59 = "2" Then
    Me.Anthologies.Visible = True
    Me.Anthologies.Text41.Value = "Anthology"
    If Me.Frame59 = "3" Then
    Me.Anthologies.Visible = True
    Me.Anthologies.Text41.Value = "Collection"
    Me.Author = Form.Author
    If Me.Frame59 = "1" Or "4" Then
    Me.Anthologies.Visible = False
    End If
    End If
    End If

    The error is Method or Data Method not found. Not sure what to try next.

    Monday, June 26, 2017 3:49 AM

All replies

  • Hi,

    Which line gets highlighted when you debug?

    You'll probably better off using a Select Case instead of nested If/Then statements.

    Also, If Me.Frame59 = "1" Or "4" will need to be more like If Me.Frame59="1" Or Me.Frame59="4".

    Just my 2 cents...

    Monday, June 26, 2017 5:39 AM
  • Hi BuddyK46,

    In my test, error happens on lines like this "Me.Anthologies.Text41.Value = "Anthology"", is that same as you? You could try to call a control in the subform like this

    Me.Anthologies.Form.Text41.Text = "Test"

    Best Regards,


    Tuesday, June 27, 2017 10:11 AM
  • You must refer to a Subform correctly, using syntax like this:


    Note the "NameOfYourSubformCONTROL". This is the name of the Subform Control on your main form, and may or may not be named the same as the Form you're using as a Subform (yes, it's confusing!!).

    For example, if "Anthologies" is the name of the Subform Control on your main form:

    Me.Anthologies.Form.Text41 = "Anthology"

    I'd also encourage you to use a proper nameing convention as you learn to develop. "Text41" does not tell you anything, whereas "txTypeOfSet" tells you a great deal more.

    Also, that last Else block looks like it would cause you troubles. If you insist on use If - ElseIf instead of a Case block, it should be more like:

    If Me.Frame59="1" OR Me.Frame59="4" Then

    -- Scott McDaniel, Microsoft Access MVP

    Tuesday, June 27, 2017 10:42 AM