Results 1 to 12 of 12
  1. #1
    dylcon is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Ann Arbor
    Posts
    130

    Query Criteria

    Hi, I am using a form to filter the records from a table based on a specific field. When I run the query, I set the form's specific field in the 'criteria' portion on the query. Here is my syntax:



    Code:
    [Forms]![MainMenu]![NavigationSubform]![PartRecordForm].[Form]![PartNamecbo]
    but I keep getting prompted for this value each time it is executed. Does anyone have any suggestions?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    How are you adjusting the form's filter? What is the prompt describing as missing ? Is it looking for the control PartNamecbo or a field within the recordset?

    Can you post all of the code relevant to your Where criteria?

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Is your subform a continuous or single?

    if it's continuous your query will really have no way of distinguishing which record is the correct one to look for.

    I'm assuming this is for a query that is not driving the main form either, that you're trying to use an item selected in the subform as part of, say a query or report, that is unrelated to the form itself?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    @ rpeare

    Seems like a navigation form/control also

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Don't use navigation forms! (personal opinion - don't like them, find them harder to work with)

    Is this a web database?

    Review https://www.accessforums.net/forms/t...orm-32053.html

    Maybe:

    [Forms]![NavigationForm]![NavigationSubform]![PartRecordForm]![PartNamecbo]
    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.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by June7 View Post

    Maybe:

    [Forms]![NavigationForm]![NavigationSubform]![PartRecordForm]![PartNamecbo]
    I just realized I am in the Queries forum.

  7. #7
    dylcon is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Ann Arbor
    Posts
    130
    June7, I tried your suggestion, but am still having the same problem. My entire db is using a navigation form and is quite large so I am not sure if I want to change it now... any other suggestions?

    I also believe that it is a single form.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You do not have to use parameterized queries to include dynamic criteria. You can adjust the recordsource of the form using the form's On Load event handler.

  9. #9
    dylcon is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Ann Arbor
    Posts
    130
    Ok, so how exactly would I do this?

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Think will still be same issue of referencing the control on Navigation form in code (VBA or macro). Navigation form really complicates. Sorry, I have nothing else. The link I referenced is as far as I got with Navigation form.
    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.

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I don't know where the control with the variable is located. Like June said, you may run into the same object reference issue. Can you explain where the subform is that needs the filtered recordset and where the combo is?

    For instance, the combo is in a main form; the Navigation control is in the main form, the subform is in the nav control's container.

    Or maybe you used the wizard to build a Navigation form. Then explain where the objects are for that scenario.

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Another option may be to use the Navigation Button's "Navigation Where Clause" property. Maybe you could associate that property with an afterupdate event of a combo.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-02-2013, 11:07 AM
  2. Replies: 5
    Last Post: 05-01-2013, 11:39 AM
  3. Replies: 5
    Last Post: 09-20-2012, 03:27 PM
  4. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  5. Replies: 1
    Last Post: 07-13-2011, 11:00 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