Results 1 to 2 of 2
  1. #1
    gem1204 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    32

    Query critera from form that is now a suborm

    I have a form that uses a query that gets criteria from the form. Example:

    Code:
    The form name is frmBookingInfo and the criteria for the query that is the recordset is BookingID = [Forms]![frmBookingInfo]![txtLkBookingID]
    I have my query set up as the recordset with the criteria coming from 10 fields with criteria coming from text boxes on the form. I have it set up and everything was working great. Now I’ve been told that the form can be used as a stand alone form or it could also be used on a navigation form. I know from experience the query won’t work from the navigation form because the query is not referencing the correct form which would now be a subform.

    I know the solution would be to modify the query parameters to user paramaters and enter the paramaters manually or thru vba which would really be a hassle especially since I was lazy and didn’t bother to create them as named paramaters. and I'n not sure how to supply the paramaters when the form opens

    Has anyone ever had this problem before and if so how did you fix it? -

  2. #2
    MatthewR is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    118
    Would something like this work as your criteria?

    IIF(isnull([Forms]![frmBookingInfo]![txtLkBookingID]),Forms![NAVIGATION FORM NAME]![SUBFORM CONTROL NAME].Form![txtLkBookingID],​[Forms]![frmBookingInfo]![txtLkBookingID])



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

Similar Threads

  1. DSum with Multiple Critera in a Query
    By flamingphoenix in forum Queries
    Replies: 1
    Last Post: 11-11-2014, 11:04 AM
  2. Query Critera w/ two Paths
    By Mike4172 in forum Queries
    Replies: 6
    Last Post: 04-10-2013, 08:47 PM
  3. Replies: 7
    Last Post: 03-17-2013, 07:12 AM
  4. multiple seach critera
    By dirtbiker1824 in forum Queries
    Replies: 1
    Last Post: 03-29-2011, 01:17 PM
  5. Query that would search multiple critera and delete
    By justinwright in forum Queries
    Replies: 2
    Last Post: 08-25-2010, 10:05 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