Results 1 to 3 of 3
  1. #1
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60

    vba query question

    Hi folks

    Would like to know how if it is possible to combine 2 queries into one.

    TableA
    SaleDate Model1 Model2 Model2
    1/1/2011 1 0 5
    1/1/2011 5 1 0
    1/2/2011 2 4 1
    1/3/2011 0 1 1


    1/3/2011 4 1 2
    1/3/2011 5 0 4
    1/3/2011 6 1 4

    I have a simple query to sum how many sold per day
    I have a simple query to do %model sold: %model2 = #Model2/(#Model1+#Model2+#Model3)

    I take care of division by zero issues.

    Question:
    is it possible to combine the sum query with the calc % query into one? Sort of how do I get the sum done first in a vba sql query and then followed by the %calc query?

    Thanks for your help

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Assume you are using a Group By totals query. Try:

    PctModel2: Count(Model2)/(Count(Model1)+Count(Model2)+Count(Model3))

    Select 'Expression' in the Total row of the query designer.

    Avoid special characters and punctuation in names.
    Last edited by June7; 10-08-2011 at 08:33 PM.
    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
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60
    Hi June7

    Many thanks for the help. This solves the issue. I appreciate your help.

    Any idea how to mark this as solved?

    Mike

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

Similar Threads

  1. Query Question
    By CarlV in forum Access
    Replies: 2
    Last Post: 09-20-2011, 06:25 AM
  2. Query question
    By j2curtis64 in forum Queries
    Replies: 8
    Last Post: 07-29-2011, 01:45 PM
  3. Query Question
    By starhannes in forum Queries
    Replies: 13
    Last Post: 05-06-2010, 04:05 PM
  4. Query with a question
    By sagit3 in forum Queries
    Replies: 0
    Last Post: 06-11-2009, 07:10 AM
  5. Query Question
    By blewis in forum Queries
    Replies: 0
    Last Post: 04-16-2009, 01:37 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