Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    melonwand is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    19
    My apologies it's frmPartNumbers.



    Thanks,
    Dawn

  2. #17
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,593
    I tried poking around in there but was not able to see what you described.

    Could you spell it out for me - step by step - what I should do to see what you're talking about?

    When I open the Form and pull up F2010 I don't see the numbers you mention.

    I see Qty Sold - 48, and Available Sale 16028.25.

  3. #18
    melonwand is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    19
    Ok, that number is exagerated. That number is supposed to be the total of the "Sq Ft Available by Batch" (subform) minus the Qty Sold. I'm not sure by it's increasing the quantity.

  4. #19
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,593
    I'm attaching a jpg of what i see when I run the form and get F2010 from the drop-down box.

    The Sq Ft Available by Batch subform actually has TWO rows of data - two batch numbers & the first row has Batch Number 32246 & Batch Sq. Ft. 438.75.

    It seems to me that your total [16028.25] isn't in any way connected to the total of the two numbers in the "Sq Ft Available by Batch" subform.

    Where is that calculation being done that subtracts 48 & is giving me 16028.25?

  5. #20
    melonwand is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    19
    If you look at that subform, the query is Stock/Batch Qry and the numbers are all messed up. The footage is correct in the inventory table. I'm not sure where the mess up is, but my queries are not calculating correctly. I'm about to pull out all of my hair. Any suggestions??? I'm all ears and eyes.

  6. #21
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,593
    Could you paste the SQL for your 'Stock/Batch Qry' here for me, please?

  7. #22
    melonwand is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    19
    SELECT Inventory.PartNumber, Inventory.BatchNumber, [Stock Qty Query].SumOfQty, Sum([SO Parts/Pricing].ActualSF) AS SumOfActualSF
    FROM [Stock Qty Query] INNER JOIN (([Part Numbers] INNER JOIN Inventory ON [Part Numbers].PartNumber = Inventory.PartNumber) LEFT JOIN [SO Parts/Pricing] ON Inventory.BatchNumber = [SO Parts/Pricing].BatchNumber) ON [Stock Qty Query].PartNumber = [Part Numbers].PartNumber
    GROUP BY Inventory.PartNumber, Inventory.BatchNumber, [Stock Qty Query].SumOfQty
    HAVING ((([Stock Qty Query].SumOfQty)>0))
    ORDER BY Inventory.PartNumber, Inventory.BatchNumber;

  8. #23
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,593
    It might be a little before I can get to this - but the thing that strikes me right away is that you are once again grouping by Inventory.BatchNumber.

    I followed your query back and found that the Query from which you are getting your Sums for the Part Numbers - is returning the correct Sums.

    See if you can fix this last query of yours by not grouping on Batch Number. It's the same reason as I explained in the context of another query of yours. You have Part Numbers that have more than one Batch Number - so if you group on Part Number AND Batch Number, any Part Number that has more than one Batch Number - will be duplicated for each Batch Number.

    Play around with it - literally - you'll get it working.

    I'll help if you can't get it to work - but I think you will be able to fix this yourself.

    Instead of your 'Stock/Batch Qry' - create a new query [name it Stock_Batch_Qry maybe?] without the Batch Number field - and before you do any grouping - make sure your totals are coming in correct.

    Let me know how it goes. I'm a little busy right now but I should have time to help later if you haven't figured it out.

  9. #24
    melonwand is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    19
    I'm not sure how all of that happened because I basically copied and pasted what you had originally sent me. Maybe I'm over complicating this. Can I have a form that calculates in a text field in the code ex. On Load etc....

  10. #25
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,593
    Yes - You can have a calculated field on a Form.

    All you need to do if you have the correct Numbers for what is in stock and what has been ordered - you can easily do the Math in code.

    What you'll need to do is:

    Declare Variables for Qty Available, Qty Ordered, Qty Remaining:
    Dim intQtyAvailable, intQtyOrdered, intQtyRemaining as Integer

    1. Have a Text Box [QtyRemaining] on your Form into which you want the calculated total to go.

    2. SetFocus on the Qty Available text box:
    Me.QtyAvailable.SetFocus

    3. Get the value from QtyAVailable:
    intQtyAvailable = Me.QtyAVailable

    4. SetFocus on the Qty Ordered text box:
    Me.QtyOrdered.SetFocus

    5. Get the value from Qty Ordered:
    intQtyOrdered = Me.QtyOrdered

    6. Set focus on QtyRemaining text box.

    7. Set value of QtyRemaining:
    Me.QtyRemaining = intQtyRemaining

    You'll have to make sure you can get the correct values into QtyAvailable and QtyOrdered.

    Hope this helps.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. 'Total rows' in query
    By sk88 in forum Access
    Replies: 4
    Last Post: 08-29-2011, 09:31 AM
  2. Cumulative total in query
    By MikeWaring in forum Queries
    Replies: 2
    Last Post: 12-18-2010, 01:40 PM
  3. Help with Query Total
    By mohara in forum Queries
    Replies: 4
    Last Post: 08-20-2010, 02:35 PM
  4. Total all months in query or report
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 10-23-2009, 08:41 AM
  5. Total a Query
    By Bridgid in forum Queries
    Replies: 0
    Last Post: 09-05-2009, 02:51 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