Results 1 to 5 of 5
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    subform openform

    All, I closed a thread similar to this. I have a form with two subforms. I created a txt control to link the two subforms together. The 2nd subform is not linked to the main form; only the 1st subform. I put a cmdButton on the 2nd subform to open a popup form in datasheet view. I am having trouble with referencing the two subforms so only records from the selected details appear. For my other popup form; I put a cmdButton on the main form to open records result in the 1st subform:
    Code:
        DoCmd.OpenForm "popupFormName", , , "CustID = " & Me.CustID
    Works great. But won't work with the two subforms. I tried: DoCmd.openform "popupFormName", , ,"subform1.txtControl= " & Me.Control

    I hope I explained this clearly. Obviously; I'm doing something wrong...Please help

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,901
    It's not totally clear what you want.

    Button and code are on main form and the parameter you want is on subform?

    Reference a field in RecordSource of popup form that needs to be filtered.
    If the field is text type, use apostrophe delimiters.

    DoCmd.openform "popupFormName", , ,"fieldname = '" & Me.subformcontainer.controlname & "'"


    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
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Gm ..thanks for replying..I apologize I didn't make myself clear..I have the too subforms linked on the mainform n when the 1st subform is filtered to a record, the 2nd subform filters the corresponding record. But the 2nd subform has many records so I made another form to open in datasheet view so users can see all records at one time. I was able to do this for the 1st subform because it was linked to the main form with the code n was able to put the button to open the popup form. I referenced but having a problem with the code I put on the 2nd subform to tie in with the 1st subform

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,901
    You want to open a popup form from each subform? Code for 1st subform works but code for 2nd subform doesn't? If button is on 2nd subform, your original code should work.

    Why don't you just have 2nd subform in datasheet view?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Took ur advice and opened in datasheet view..thanks

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

Similar Threads

  1. Replies: 3
    Last Post: 01-15-2019, 02:46 PM
  2. VBA/Form Navigation w/SubForm OpenForm Code
    By kennyrogersjr in forum Forms
    Replies: 6
    Last Post: 05-01-2014, 09:59 AM
  3. Replies: 18
    Last Post: 11-20-2013, 05:45 PM
  4. Replies: 2
    Last Post: 12-17-2010, 11:12 PM
  5. OpenForm in subform not working
    By eyuen in forum Forms
    Replies: 3
    Last Post: 11-10-2010, 12:03 PM

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