Results 1 to 6 of 6
  1. #1
    JakeMann41 is offline Novice
    Windows 11 Office 365
    Join Date
    Aug 2024
    Posts
    14

    Help with a Query

    Hi Guys

    I need a bit of guidance on query writing

    I have created a basic database that will remove and add stock (see attached)

    The MovementsForm has buttons that will look at the queries (macro attached to the buttons) and remove stock correctly as per the MovementsTable

    I would like to develop this further so that when the buttons are pressed on the Form the process would be-



    Look at [ItemsTable].[StartingStock]
    Subtract or add stock based on the information inputted into the Form
    Return the balance from what was entered on the form back into [ItemsTable.][CurrentStock]
    Attached Files Attached Files

  2. #2
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    I have created a basic database that will remove and add stock (see attached)
    you always count in text?
    The MovementsForm has buttons that will look at the queries (macro attached to the buttons) and remove stock correctly as per the MovementsTable
    you tell it works but i not see my numbers back any where.
    btw calculations u not save in tabels
    Return the balance from what was entered on the form back into [ItemsTable.][CurrentStock]
    you not do an execute if the values are not all valid

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    I do not believe you need a starting stock.
    Add a date to your movements table plus anything else you might need, like who added/edited any entry?
    Then it is a case of summing for a particular item.
    You already have the negatives and positives for out and in.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,880
    Take a look at allen browne's article.

    http://allenbrowne.com/AppInventory.html
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #5
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,180
    If you want a stock application you will always need to have a stock table, ask any logistics engineer, so min tables are
    - Items (or Products/Articles)
    - Movements (In/Out/Corrections, ...)
    - Stock: current stock qty
    I see some discussions here for not needing a stock table, but only on Access forums, so I wouldn't know why Access would work in another way.
    If you have a stock table, you can use macro's with action queries that keep the current stock actual/

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    My thoughts were, you just have a positive transaction for the stock.
    If you wish to hold that in a seperate table, so be it ?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

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