Results 1 to 6 of 6
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    Multiple query question

    Hi



    Have my database working perfectly as I want (thanks to everyones help).

    I'm now trying to use my accumulated vast and expert knowledge ;-) to tidy up things.

    I have six tables set up in three sections for want of a better description

    tbl Parish ---tbl Church ---tbl baptism

    tbl Parish ---tbl Church ---tbl banns

    tbl Parish ---tbl Church ---tbl marriage

    tbl Parish ---tbl Church ---tbl death

    with tblparish, tbl church being common

    1 parish linked to many churches linked to many births, marriages, etc etc.

    OK I have multiple queries to search births, banns marriages and deaths by year, surname and forename etc etc.

    It all works no problem but I do have 52 queries and multiple "identical" forms based on these queries.

    As I said it all works and is not slow.

    Should I just be happy or should I be looking for a way to reduce the number of tables and queries?

    thanks

    Ian

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    no of tables - probably OK, but perhaps the last 4 can be combined into one with the addition of a 'type' field and maybe a couple of redundant fields for variation of type. Depends on the fields you have.

    number of queries seems excessive and you should really not have multiple identical forms. If they are multiple because of adding/editing etc these functions can be combined and parameters set depending on function required.

    For forms, you have 6 tables, so as a minimum you should only need to have 6 forms (plus perhaps a navigation form) and no queries (recordsource would be the table) or if you want a query then 6 queries.

    You could also have a single 'base' query for reporting purposes and just modify the criteria for what is required - you would left join parish to church and left join church to each of the other 4 tables.

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    If you have "Identical forms" only because each has a different recordsource query, you can use a single form and change its recordsource property in code before opening it.

    Alternately, you can also create queries on the fly in code with a common name, such as qTempQuery. The form above would have qTempQuery as its recordsource and a different as needed qTempQuery would be created before opening it.

    These techniques, especially the latter can reduce the number of named queries significantly. The syntax for the 52 queries (if still needed) would be in a module, all created as needed with a set of common query names to be used by reports or forms.

    If this appeals to you, I can post a demo db showing how to create queries on the fly from their SQL strings and how they work as a form recordsource.
    Last edited by davegri; 07-04-2016 at 09:29 PM. Reason: clarity

  4. #4
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Quote Originally Posted by davegri View Post
    If you have "Identical forms" only because each has a different recordsource query, you can use a single form and change its recordsource property in code before opening it.

    Alternately, you can also create queries on the fly in code with a common name, such as qTempQuery. The form above would have qTempQuery as its recordsource and a different as needed qTempQuery would be created before opening it.

    These techniques, especially the latter can reduce the number of named queries significantly. The syntax for the 52 queries (if still needed) would be in a module, all created as needed with a set of common query names to be used by reports or forms.

    If this appeals to you, I can post a demo db showing how to create queries on the fly from their SQL strings and how they work as a form recordsource.
    Hi

    thanks for the the idea would love to see the database and how it works

    cheers

    Ian

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,706
    Attachment 25107

    Attachment 25108

    OK, see the above pic. The attached db shows how to use a named query, qtempQuery as the named recordsource for the two forms and the two reports and how to change what qtempQuery pulls from the tables as needed on the fly.
    Notice that qtempQuery is the only query shown in the navigation pane, not 4 separate queries.

  6. #6
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    THanks, I'll start studying

    Ian

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

Similar Threads

  1. Multiple Many to many relationship question
    By nycman in forum Database Design
    Replies: 31
    Last Post: 09-03-2015, 02:42 PM
  2. Multiple value look up question
    By Ricekrispycan in forum Database Design
    Replies: 9
    Last Post: 01-26-2015, 04:10 PM
  3. Replies: 6
    Last Post: 02-26-2014, 05:06 PM
  4. Novice question about multiple users
    By Buakaw in forum Security
    Replies: 3
    Last Post: 07-27-2011, 10:21 AM
  5. multiple license question
    By pdougan in forum Access
    Replies: 1
    Last Post: 05-05-2011, 07:36 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