Results 1 to 5 of 5
  1. #1
    dsmithe is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    24

    open another form from inside a form with using subform

    I have a form named comboform that has a navigation bar and 3 subforms: application, permit, and certificate. The form permit is going to change but that change can't affect past data. I.e. If I look at a permit from last year it should look like the form from last year. The form permit will be changing often over the next few years. I don't want to keep adding subforms to comboform. I have the following permit forms:
    permit - current permit form
    permit2013-20180888 - permit form used from 2013 to September 1st 2018


    permit2007-2012 - permit form used from 2007 to 2012

    I already have the logic to call the different forms:
    Code:
            If permitno < 20180888 And permitno >= 20130000 Then
              DocName = "permit2013-20180888"
            ElseIf permitno < 20130000 And permit >= 20070000 Then
              DocName = "permit2007-2012"
            Else
              DocName = "permit"
            End If
            
            DoCmd.OpenForm DocName, A_NORMAL
    however when the form opens the navigation bar disappears because it is a part of comboform and not a part of the permit form. Is there a way open the other permit forms with navigation without including them in comboform? Can 1 subform open different forms? I.e. have a blank subform in comboform and when I click on permit in the navigation bar, the logic above is called, and the correct permit form name is put in the subform.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    If you constantly change the permit, you will have to change the form too.
    Instead of making subforms (tho you can) just make a full form to enter data. (tho its still bound to the master record)

    to me, you only need to enter the fields, you dont need the form.
    once you enter data into the fields, the new form can be 'filled'.
    no need to save old forms, just save the PDF. This way you only have 1 subform at all times.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Certainly should be able to set SourceObject property of subform container control. One method uses BrowseTo command https://msdn.microsoft.com/en-us/vba...-method-access

    However, I agree that data entry form does not have to exactly mimic paper form in appearance. Life will be simpler if you don't try to. Changing form does not change data. If you need the data output in a specific format, use report.
    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
    dsmithe is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    24
    The form changes are just adding and removing fields. What I want to do when I make a change is make a copy of the form, paste with a new name which becomes the old permit form, change the permit form, add a little logic to the form which selects the correct form based on the permit number that was entered. I didn't want to have to all of that and add a new subform to comboform. So now I have:
    Code:
    If permitno < 20180888 And permitno >= 20130000 Then
      Forms![ComboForm]![Permit].SourceObject = "permit2013-20180888"
    ElseIf permitno < 20130000 And permit >= 20070000 Then
      Forms![ComboForm]![Permit].SourceObject = "Permit2007-2012"
    Else
      Forms![ComboForm]![Permit].SourceObject = "permit"
    End If
    and things are working the way I want. Even when scrolling one at time the permit form changes when necessary. I think I will change the If Then ElseIf logic to a select case in the near future.

    Thank you for the suggestions.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What I have done is to have 1 form and code behind that form manages display of controls and/or sets ControlSource property. But perhaps the differences between your permit forms are extreme enough to make that more unwieldy than maintaining multiple forms.
    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.

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

Similar Threads

  1. Help/Advice for a subform inside a form
    By balderman in forum Access
    Replies: 3
    Last Post: 12-01-2017, 03:59 PM
  2. Replies: 0
    Last Post: 06-17-2016, 05:17 AM
  3. Opening Form To a Record Inside a Target SubForm
    By RichardAnderson in forum Forms
    Replies: 5
    Last Post: 04-18-2014, 05:19 PM
  4. Replies: 1
    Last Post: 08-11-2011, 06:22 AM
  5. Replies: 1
    Last Post: 08-03-2009, 08:24 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