Results 1 to 2 of 2
  1. #1
    sboelitz is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    1

    Code problem

    Hi im new here and fairly new to access to and am a bit stuck with VB code. I am trying to make a database to use for stock control of toners and will allow us to sell consumables to internal departments. however i have become stuck as i am trying to make it so it wont allow us to place an order if there is no stock and wont take more stock off the list than what we have as it currently goes in to minus stock.

    When the save button is pressed this is the code that runs

    '------------------------------------------------------------
    ' Command14_Click
    '
    '------------------------------------------------------------
    Private Sub Command14_Click()
    On Error GoTo Command14_Click_Err


    ' Opens stoock check form
    DoCmd.OpenForm "StockLevelCheck", acNormal, "", "", acEdit, acHidden
    ' Disables warning messages
    DoCmd.SetWarnings False
    If (Forms!StockLevelCheck!Stock <= 1) Then
    ' Removes stock from toner list


    DoCmd.OpenQuery "cosumables-remove", acViewNormal, acEdit
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.Close acForm, "consumables-sell-new"
    DoCmd.Close acForm, "consumables-sell-new"
    End If
    ' enables warning messages
    DoCmd.SetWarnings True
    If (Forms!StockLevelCheck!Stock = 0) Then
    Beep
    MsgBox "Ops... None in stock!", vbExclamation, "None in stock"
    End If
    If (Forms!StockLevelCheck!Stock = 1) Then
    Beep
    MsgBox "That was the last toner!", vbExclamation, "Low stock!"
    End If
    DoCmd.Close acForm, "StockLevelCheck"
    If (Forms!StockLevelCheck!Stock = 0) Then
    DoCmd.Close acForm, "consumables-sell-new"
    End If




    Command14_Click_Exit:
    Exit Sub


    Command14_Click_Err:
    MsgBox Error$
    Resume Command14_Click_Exit


    End Sub

    Could someone help me please as im confused after spending a few days looking at it...

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I don't have specific advice for you. However, Inventory Control is not a simple or trivial subject. As you get more involved with multiple suppliers, products with serial numbers, reorder levels, variations in pricing and discounts it can be extremely complex.

    You might try google for inventory control or stock control with reorder points and possibly back orders.
    There are inventory data models at http://www.databaseanswers.org/data_models/index.htm that may help with some structures.

    You may also find some ideas from Allen Browne's info at http://allenbrowne.com/appinventory.html

    It would help if you posted a jpg of your tables and relationships to help people understand what you have currently.

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

Similar Threads

  1. Problem in report and used code...
    By manos39 in forum Reports
    Replies: 12
    Last Post: 11-23-2011, 05:24 PM
  2. Problem with Code
    By jackiea in forum Programming
    Replies: 1
    Last Post: 10-07-2011, 05:59 PM
  3. Code Problem
    By Jeddell in forum Programming
    Replies: 2
    Last Post: 09-29-2011, 06:31 PM
  4. Alert Message Code Problem
    By 10 Gauge in forum Forms
    Replies: 1
    Last Post: 03-15-2011, 12:17 PM
  5. Problem with Code
    By cujee75 in forum Programming
    Replies: 0
    Last Post: 03-10-2006, 02:40 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