Results 1 to 8 of 8
  1. #1
    redekopp is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108

    Opening a different form in my subform via button click

    Hi there, im having a hard time trying to figure out how to open a form I made In my subform below after making a selection. Whats there initially is the default form. I cant seem to figure out how to make the macro work. And I definitely don't know what to type to make it work via VBA.
    If anyone can help that would be appreciated. Thanks!


    Click image for larger version. 

Name:	reportsbfrm.PNG 
Views:	10 
Size:	16.3 KB 
ID:	22618

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You change the subform container control SourceObject property. I don't know if macro can do that.

    Name the container something like ctrSub.

    Me.ctrSub.SourceObject = "some form name"


    This is what Navigation form is supposed to accomplish without code. However, I never use navigation form. Nor have I ever used dynamic subform container. I use Tab control with subforms on tab pages.
    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.

  3. #3
    redekopp is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108
    That was easy, thank you for that. I wish the whole tab control with subforms on tab pages was English to me ! ill google it

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Opening a lot of subforms at once can make a form slow to load. Your code method emulating tab control (or navigation form) is probably just fine, unless one subform needs to reference data on another subform (something I have to do).
    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.

  5. #5
    redekopp is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108
    Sorry, that actually worked, but then it sets it as its default. So now when I open the form it goes to frmHoursbyEmployee which is what I want it to make appear when I click the button, instead of frmDefaultReport which is what I want it to be when I open the form originally. It overwrites the default. how do I make it just change it temporarily?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Set the SourceObject property when closing main form. Could use the main form OnClose event.
    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
    redekopp is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108
    Thanks, is there an easy way I can make a button on that form to export to a printable report the data that's been filtered? im guessing its print preview form.

    I think ive screwed myself over. Im trying to make a print preview of this sorted report but I want the button to come from the form not from the report. So I want to print the sorted report only, not the form from which we are seeing it. the subform from where it lies.



    Click image for larger version. 

Name:	report5.PNG 
Views:	7 
Size:	26.5 KB 
ID:	22626

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Apply filter criteria to the report.

    What is the filter criteria and how is it applied to form? Is it the date range?
    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. Replies: 2
    Last Post: 11-14-2014, 03:07 PM
  2. Replies: 9
    Last Post: 10-30-2014, 12:31 PM
  3. Replies: 6
    Last Post: 11-18-2013, 12:03 PM
  4. Replies: 6
    Last Post: 01-11-2013, 11:33 AM
  5. Filter subform on button Click
    By atom in forum Forms
    Replies: 2
    Last Post: 04-18-2012, 09:43 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