Results 1 to 5 of 5
  1. #1
    robbeh is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    55

    Question Two forms using one query

    I have a database that has a full search form with 10+ fields. It displays a query results form based on the data entered into the text boxes.

    It works pretty good (small issue I am exploring in another thread). My question is, I am also creating a form with a quick search for one of the fields. My question is, can I use the same query with 2 different forms.



    Essentially my code in the query builder looks like:

    Forms!frmMenu!txtQuickSearch Or Forms!frmFullSearch!txtAccountNumber

    The problem is, if I use the quick search I get the dialog popup to enter the data for the full search. However, if I go to the full search it works fine.

    Any ideas what is going wrong? Is this even possible?

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Does this query have dynamic parameters that reference the 10+ textboxes? If the form is not open and available then the query will do popups.

    I never use dynamic parameters in queries. I use VBA code to construct filter criteria and apply to form Filter property.

    Instead of form RecordSource referencing a query object, can put SQL statement in the RecordSource.
    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
    robbeh is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    55
    Thanks June,

    That is the case then, the form is not loaded or active so it's popping up. When the full search loads, the quick search is still loaded, just set to visible=false.

    I am going to look into using the VBA to construct queries. I am relatively green in Access but feel that learning more VBA/SQL is going to be very benificial going forward.

    I will post back here if I have any questions but first I am going to try it on my own.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Example of code to build filter criteria http://allenbrowne.com/ser-62code.html
    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
    robbeh is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    55
    Quote Originally Posted by June7 View Post
    Example of code to build filter criteria http://allenbrowne.com/ser-62code.html
    I don't know a ton of VBA but man that has to be the best commented/newbie friendly code I have ever seen. Learned a ton. Applied to two text boxes without a hitch. Will now try the whole form.

    Thanks June7

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

Similar Threads

  1. Replies: 5
    Last Post: 10-01-2014, 08:06 AM
  2. Query/Forms
    By e51lrrp in forum Queries
    Replies: 3
    Last Post: 04-30-2014, 03:22 PM
  3. Forms and Query Tables
    By 82280zx in forum Forms
    Replies: 13
    Last Post: 02-04-2014, 05:40 PM
  4. Query and forms
    By Nixx1401 in forum Access
    Replies: 5
    Last Post: 02-15-2010, 01:02 PM
  5. Query / Forms ??
    By caljohn527 in forum Forms
    Replies: 1
    Last Post: 02-11-2009, 09:59 PM

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