Results 1 to 8 of 8
  1. #1
    tazquebec is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    6

    How can I check if a sub form was expanded?

    Please look at the print screen first

    I want to perform an operation went a sub form has been expanded.

    I need access to the fields of the sub form on the click even of a button.

    Forms![BASE].Controls("subfrmBase").Controls("frmSoumission_CT S").Controls("frmSoumission_CTS_Elements")!drpdwn_ ref_Element.Value

    If the sub form was not expanded I get an error.

    I want to display a message when that happens.

    If the sub form was expanded and then decreased, then I have access to the fields.

    In that case I want to be able to check for that.

    Basically, I want to know if the user is on a record of the sub form.



    Thanks for the help

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Your thumbnails are not forms, but table views.

    Display those tales in form and subform datasheet views. Then on the on event reference the approprate field.

  3. #3
    tazquebec is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    6

    I am using form aqnd sub form

    When the form is first open the sub form "frmSoumission_CTS_Elements" of the Subform frmSoumission_CTS is not expand. There are not controls defined.

    When the sub form "frmSoumission_CTS_Elements" is expand by pressing the plus sign. The controls are then defined.

    I have access to the fields of the sub form I want to reach.

    Forms![BASE].Controls("subfrmBase").Controls("frmSoumission_CT S").Controls("frmSoumission_CTS_Elements")!ref_SCT S

    If the sub form of the fields I need access to is shrink, I still have access to them. Which, I also need to know.

    So what I need is to know if the user is now pointing to a record of my sub form "frmSoumission_CTS_Elements".


    Thanks

  4. #4
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Code:
    Forms![BASE].Controls("subfrmBase").Controls("frmSoumission_CT   S").Controls("frmSoumission_CTS_Elements")!ref_SCT  S 
    is nonsence and incorrect syntax. I can't tell what you are trying to reference.

    A form must be populated before populating a subform. If your form is populated and your subform does not expand, the subform has no data or the subform's record source is incorrect. Moving to a new record on a subform will always generate a record, but it may be an orphan if the form & subform are not properly related.

  5. #5
    tazquebec is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    6

    The systax is correct

    Forms![BASE].Controls("subfrmBase").Controls("frmSoumission_CT S").Controls("frmSoumission_CTS_Elements")!ref_SCT S

    When I put the line above in a message box I get a value when the sub form was expand a first time. If the sub form as not been expand before I get a error message.

    With the debugger I can see that I can not have access to controls is the sub form was not expanded.

    Hope these precision help

    Thanks for you help

  6. #6
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    THe Access expression builder would build a subfoirm reference as
    Code:
    Forms!FormName.SubformName.Form.SubformControlName 
    a subsubform reference as
    Code:
    Forms!FormName!sbformName.Form!SubsubformName.Form!SubsubFormControlName 
    Do the tables the subject of the form, ther subform and subsubform have relationships viewable in the Relationships window?

    Are the LinkChildFields and LinkMasterFields properties of your subform and subsubform properly set?

  7. #7
    tazquebec is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    6

    Relationships

    I am using Access 2003 ans my database are on SQL Server 2005.

    That probably I do not see where I can get the relationships window.

    Under witch menu should I find that?

    Yes my LinkChildFields and LinkMasterFields properties of my subform and subsubform properly set.

    The following code work when the subsubform as been expand. It does not work if not.

    Code:
    Forms![BASE].Controls("subfrmBase").Controls("frmSoumission_CTS").Controls("frmSoumission_CTS_Elements")!ref_SCTS
    I think what I need to test is:

    • Do I have access to the control of the subsubform
    • Is the subsubform expanded

    Thanks

  8. #8
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Code:
    subsubform expanded 
    are not words of art in Access, that it, it has no meaning.

    A subsubform is a "subform" of a subform.

    I presume what you are saying that for some subform record, a subsubform record is not being displayed. That means that there is not a subsubform record related to the displayed subform record or that the subsubform is not properly bound (to its record source).

    Subsubforms should not be populated before its parent subform is populayed. Similarily, subforms should no the populated before its parent form is populated.

    Stately genericaly, you have a parent, child and grandchild. You can't have a granchild without a child and cannot have a parent.

    An orphan is a subform or subsubform that does not have an immediately preceding ancestor.

    Code:
    Do I have access to the control of the subsubform 
    You will have access to a control on a subform if the subform recordsource has a related parent but only if you have a correct subform recordsorce.

    Code:
    Is the subsubform expanded 
    If it has a related form record.

    Do you forms display the navigation buttons, or is there only one record for the subform and one for the subsubform? If so, you should always be able to add a new record.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-29-2014, 09:58 PM
  2. check box criteria?
    By kzoll@mindspring.com in forum Queries
    Replies: 3
    Last Post: 11-24-2009, 09:43 AM
  3. Replies: 0
    Last Post: 10-12-2009, 08:26 AM
  4. Check Box Value
    By mulefeathers in forum Programming
    Replies: 4
    Last Post: 10-09-2009, 08:31 PM
  5. Replies: 2
    Last Post: 03-13-2009, 08:35 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums