Results 1 to 11 of 11
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting Recordsource (AXP)

    Hello,
    I am trying to set the recordsource of a subform using:

    If Me.Text171.Value = 1 Then
    Forms!frmmatrixtabs!frmSummary!frmLaserBOM.RecordS ource = "qrybltbom"
    Else: Forms!frmmatrixtabs!frmSummary!frmLaserBOM.RecordS ource = "qryrofinbom"
    End If

    I am getting an error that says that object doesn't support this property or method. The subform has controls that match both queries. Does anyone have an idea what I am doing wrong?


    Thanks,
    Mark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Setting Recordsource (AXP)

    Try Forms!frmmatrixtabs!frmSummary!frmLaserBOM.Form.RecordSource = ... in both occurrences. Forms!frmmatrixtabs!frmSummary!frmLaserBOM refers to frmLaserBOM as a control on the first subform. By adding .Form you specify that you refer to frmLaserBOM as a form.

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Recordsource (AXP)

    >>Forms!frmmatrixtabs!frmSummary!frmLaserBOM.Recor dSource = "qrybltbom"<<

    "frmSummary", and "frmLaserBom": are these the names of the forms or (as they should be) the names of the subform controls the forms are contained in?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Recordsource (AXP)

    Thanks Hans,
    That seems to have taken care of the problem. I need to brush up on that subject!

    Thanks,
    Mark

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Recordsource (AXP)

    The summary and laserbom forms are subforms of frmMatrixtabs.

    Thanks,
    Mark

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Recordsource (AXP)

    >>The summary and laserbom forms are subforms of frmMatrixtabs.<<

    I realize that, but that wasn't my question. I asked whether these were the form names or the control names. When referring to a subform, you do it by referring to the subform control that contains it; you don't use the form's name itself.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Recordsource (AXP)

    Ah, sorry for the misunderstanding. Unfortunately, the form and control names are the same. This is probably the wrong way to do it but I inherited this from someone else and haven't had the time to clean things up. Would you suggest that I make the names different?

    Thanks,
    Mark

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Setting Recordsource (AXP)

    I think that Mark Liquorman just wanted to alert you to the possibility that you might be referring the wrong way. You can leave the form and control names identical.

  9. #9
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Recordsource (AXP)

    No, they don't need to be different; but standard practice suggests you use a prefix to identify controls (such as "sub"). Referring to the formname instead of the control name (when they are different) is just one of the more common mistakes (along with trying to use Forms!subformname to reference a subform).
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  10. #10
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting Recordsource (AXP)

    OK, thanks! I still don't fully understand that so I guess I will have to dig out my BIG Access book.

    Thanks,
    Mark

  11. #11
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Setting Recordsource (AXP)

    >>OK, thanks! I still don't fully understand that so I guess I will have to dig out my BIG Access book.<<

    Did you mean that part about trying to reference a subform directly from Forms collection? You can't do this because a subform is NOT an open form! It isn't even in the Forms collection. So, you must reference it via the name of the control (and the form) that contains it.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •