Results 1 to 7 of 7
  1. #1
    jemy is offline Novice
    Windows 8 Access 2013 32bit
    Join Date
    Jun 2017
    Posts
    6

    S-ubform visible on click

    I have a database that is back-flow testing. The main table is customer information. A linked table is Device Information, each had customer id. and the Device Information had its primary key set to Device #. That is because a customer can have more than one back-flow device. To the back-flow device table is linked an additional table Test Data via the device #

    This is the problem....There are up to four different type of devices...and although they have many fields in common they each have a few that are unique.

    I have designed a form called Back-flow Test Report. The parent form has the customer information. The sub form has the device information. I designed four different Test data subsubforms to go on the device information sub-form. My intent was to make the sub-sub-forms invisible and by clicking on a button labeled with the device type, the right correct test data sub-form beneath the device information would become visible. I have read many articles, questions and answers on this, however no matter what I try it still does not work.

    I understand that when you are in the design mode of the form you should be able to click on the sub-form (Outline in yellow) so that you are in the subform control name. But mine seemed to be named the same as the actual sub-form. I understand the code should be
    me![DCVA Test Data].visible=True
    At least that is what several sites said. I would truly appreciate some help.

    I have done a work around but it is clumsy and ugly

    Thank you

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    A SubForm is displayed on a Form by the use of a SubFormControl. Unless you change it, when added the SubFormControl takes the name of the SubForm it displays. I usually change that name so I don't get confused. Do you have your SubFormControls on top of one another so whatever SubForm appears will be in the same location on the MainForm?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    'Does not work' means what - error message, wrong results, nothing happens?

    Suggest you name the subform container control different from the object it holds, like ctrDCVA.

    Then code:

    Me.ctrDCVA.Visible = True

    Alternatively, use a Tab Control. Put each subform on a page of the Tab Control. User clicks on tab instead of button. No VBA needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    jemy is offline Novice
    Windows 8 Access 2013 32bit
    Join Date
    Jun 2017
    Posts
    6
    Thank you for replying. My first subform is Device Information it is on the parent form . I wanted four different data test sub sub forms to be one on top of the other but hidden on the Device Information subform until I clicked a command button with the device name ie (DVCA, RPBA, PVBA, Other) So they would be in the same location on the sub form

  5. #5
    jemy is offline Novice
    Windows 8 Access 2013 32bit
    Join Date
    Jun 2017
    Posts
    6
    I did try naming it different, I still got an error. Some of the things I read said you have do code
    Me!Form[name].Subform[Name] etc

    For many reasons my form must act as data input and a form to save as a pdf and print out. I understand forms are meant for data input and reports to print out, but in this case I really need to do this. I have done all of that. I even combined the unique fields into one test data form...it will work but it is clumsy and not the best.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Did you see post 3?

    What error?

    Code needs to set visibility of subform container control. Referencing Form object will not work for this.

    Try using dot instead bang (!).

    Me.ctrDCVA.Visible = True
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    jemy is offline Novice
    Windows 8 Access 2013 32bit
    Join Date
    Jun 2017
    Posts
    6
    Thank you so much I spent hours of research before I came here.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-09-2017, 10:41 AM
  2. Replies: 1
    Last Post: 03-21-2016, 10:40 AM
  3. Replies: 1
    Last Post: 07-07-2013, 10:25 PM
  4. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  5. Replies: 2
    Last Post: 01-06-2011, 04:38 AM

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