Results 1 to 6 of 6
  1. #1
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105

    Create Query Object vs Hard Code


    I'm new to Access so I'm sorry if this is a bit Naive but... Why would I create a query database object for a row source instead of just typing the query directly into the row source for a form/report/etc?

  2. #2
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Do you mean DDL or coding a querydef?

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you can put the query name in it... qsMyClients
    or you can click the elipsis button and BUILD the sql in it.

    I prefer the query name.

  4. #4
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    I meant coding a Querydef vs typing the query directly into the rowsource of the object...

    I understand that the querydef is technically faster, but where performance is not an issue is there a reason? Other than preference?

    It seems to me that having a large number of query objects in the database seems superfluous and makes documenting the database that much more complex....

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I prefer fewer query objects and use SQL statement in RowSource and RecordSource whenever possible. I don't know that reference to query object is faster.
    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
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    Thank you, that's helpful.

    I've taken over an existing app that the previous person has created object for each query... and I found it much more difficult to document.
    Plus, there are queries that were created for forms or reports that were later abandoned which I find is even more of a reason to not create the objects.

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

Similar Threads

  1. Replies: 1
    Last Post: 12-06-2012, 08:16 PM
  2. Replies: 2
    Last Post: 06-15-2012, 07:41 PM
  3. Code to create a query from a form
    By stryder09 in forum Queries
    Replies: 15
    Last Post: 10-17-2011, 01:55 PM
  4. Replies: 5
    Last Post: 05-25-2011, 02:34 PM
  5. ActiveX componet can't create object
    By quanmay35 in forum Access
    Replies: 1
    Last Post: 05-26-2009, 05:27 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