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

    Subform Control (AXP)

    Hello All,
    I have a form with a subform that has yet another subform inside of it. I need to access the control on the lowest level of form (which is three deep right now). Here is what I am trying to use but I get "Object doesn't support this property or method" error.

    Forms!frmmatrixtabs.frmSummary.frmLaserBOM!Text17 = strLaserPN

    I need to put a value in control text17 on the sub-subform. Any ideas? I tried all variations in the help file but those examples only go two levels deep.

    Thanks,
    Mark

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

    Re: Subform Control (AXP)

    Try using bangs:

    Forms!frmmatrixtabs!frmSummary!frmLaserBOM!Text17 = strLaserPN

    If that doesn't work, try this:

    Forms!frmmatrixtabs!frmSummary.Form!frmLaserBOM.Fo rm!Text17 = strLaserPN

    See Forms: Refer to Form and Subform properties and controls on the Access Web for a comprehensive overview of yhow to refer to controls and their properties on subforms.

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

    Re: Subform Control (AXP)

    Thanks Hans!,
    That seems to have remedied that problem. I have one other question though. I am getting an error now when loading these forms because I need to do a requery. It seems as though the form has not yet opened when the code runs. Is there a way I can make sure the form is loaded before running the requery?

    Thanks,
    Mark

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

    Re: Subform Control (AXP)

    Where do you try to requery? If possible, you might move it to an event that occurs later in the chain of events. When a form is opened, these events occur (with some repeats if you have subforms):

    Open > Load > Resize > Activate > Current

    It may help to define a boolean variable that's set to False initially, and is set to True when you know it's safe to run the requery. This might be in the Current event of the main form, or of one of the subforms; you'd have to experiment. In the code that performs the requery, skip it if the variable is false.

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

    Re: Subform Control (AXP)

    Thanks!,
    I am running the requery On Current of the first form. I believe the the form that is has to requery has not opened yet and thus is giving the error. Do you know if there is code that I can put in that will tell of my "requery" form is opened? After that, I can use the boolean value you talked about to skip the requery initially.

    Thanks,
    Mark

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform Control (AXP)

    Subforms load before their parent form, but if the subforms are linked, you shouldn't need a requery in the current event of anything.
    Charlotte

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

    Re: Subform Control (AXP)

    Thanks Charlotte,
    When the main form loaded, I got an error every time saying that the property was not valid. However, after the form was allowed to fully load, it would update the form(s) no problem. I put in a few lines of code to set a variable (under advice from Hans or Mark L) and now it works great. Basically, when the main form loads, it sets the variable to 0. After everything else is done, it sets it to 1 and pulls in the data for the subform in question. It works pretty well at this point.

    Thanks,
    Mark

Posting Permissions

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