Results 1 to 2 of 2
  1. #1
    squeezelit is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    2

    Opening a main form by filtering from subform

    Hello,

    I'm a beginner in vba Access. I have a Search Form (frm_Search) with a combo field (cboSponsorName) and button (cmdOpenBySponsor) that I intend to use for opening the MainForm. The MainForm (frm_Project) has a subform (frm_Sponsor), it's a one to many relationship. I would like to open only the main form that is filtered by a subform field (SponsorName). Please help.

    Code:
    Dim stDocName As String


    Dim stLinkCriteria As String

    stDocName = "frm_Project"
    stLinkCriteria = "SponsorName like '%" & Me.cboSponsorName & "%' "

    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try with * as the wildcard.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 02-05-2016, 02:32 PM
  2. Replies: 14
    Last Post: 03-07-2012, 03:46 AM
  3. opening a second form from main/subform
    By PJPCVP in forum Database Design
    Replies: 1
    Last Post: 10-29-2010, 09:50 PM
  4. Replies: 0
    Last Post: 08-17-2008, 12:19 PM
  5. Automatic Filtering when Opening form
    By Karyn-2000 in forum Forms
    Replies: 1
    Last Post: 12-03-2005, 09:29 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