Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902

    Sorry, thought I had fixed my post to correct the expression. However, the current data will show a negative available for ProductID_PK 8 because tbleAssigned shows 12 assigned but Quantity in tblProducts shows only 8. I deleted some records from tbleAssigned and now get positive calc with correct expression.

    Now I see the + button is not intended to alter the Quantity value.
    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.

  2. #17
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    i am seeing negative numbers, even when the quantity is a positive number. if there are 10 of an item, and i issue 1, the remaining quantity shows up as -9

    is there a way to update the "Available" control when cmbHRDescription is selected, that would give me a quantity in the available control so that i can compare it to the quantity assigned to see if there are enough available?

    something like:

    if Available >= quantAssigned then
    some command
    else
    msgbox "Not enough in inventory"
    endif

    as it is right now, there is nothing in "Available" to compare to make sure the user isn't trying to assign more than is available.
    (I should have become a dentist)

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Did you change Size/Description combobox ColumnCount and ColumnWidths properties to account for adding the Quantity field in the RowSource?

    The Available control should only update when a new record is committed. Your code will have to compare the Available against the quantity input and determine whether or not to allow the record commitment.
    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.

  4. #19
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    All of the changes were made as described, but, as "Orange" pointed out, the larger number is being subtracted from the smaller. Looks to me that the way the DSum statement is written, the overall quantity is being subtracted from the quantity assigned.

  5. #20
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Right, I got the expression backwards? Did you change? Did you see post 16? Post the expression you are using.
    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. #21
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    Sorry, I am only able to work on this thing with one half of my brain. It is working OK now I changed the expression to

    =[cmbHRDescription].[column](2)-(DSum("QuantAssign","tbleAssigned","ProductID_FK=" & [cmbHRDescription]))

  7. #22
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    Just an FYI, I got it pretty much working the way I need it to. First, I added "available.requery" to the after update event of cmbHRDescription, this updates the quantity shown as available.

    I also added an Nz() function to the DSum expression:

    =[cmbHRDescription].[column](2)-Nz(DSum("QuantAssign","tbleAssigned","ProductID_FK =" & [cmbHRDescription]))

    to handle the Null values that the function was returning where there were no values assigned to individual items.

    everything seems to be working well enough for now.

    Thanks a bunch, couldn't have done it without the help!!!

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

Similar Threads

  1. Similar to totals and Grand totals
    By Thompyt in forum Reports
    Replies: 14
    Last Post: 01-24-2015, 06:39 PM
  2. Totals and Grand Totals
    By TimC in forum Reports
    Replies: 2
    Last Post: 01-05-2015, 11:56 AM
  3. Unusual Sub Totals & Totals in Groups.
    By Robeen in forum Reports
    Replies: 12
    Last Post: 03-20-2012, 08:55 AM
  4. Replies: 5
    Last Post: 12-06-2011, 11:18 AM
  5. Month totals and Year totals
    By marksnwv in forum Access
    Replies: 1
    Last Post: 08-05-2011, 10:13 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