How to Make a ordering system in vb10+access RRS feed

  • Question

  • So i have a table and design of this.

    in the subinventory if i want to view first the stock input a subinventory on textbox then print on the other textbox w/e itemcode, itemdecs, subinventory, uom and requisition.

    now if i want to order on subinventory textbox in the second i will put any numbers that will subtract to the current number in the itemdb and if the stock is lower than 100 it will show a msg box that the current stock is lower than 100, and if the stock is 0 it will show a msg that the stock is out of stock.



    Wednesday, March 29, 2017 6:05 PM

All replies


    this is my source code..

    i only need in the Order form. first find the subinventory after click it will show the current stock on the textboxs then in the second textbox i will put how many order to be subtract to the Regbal. that's it.

    and i want a critical warning that my stock is only 100 and also out of stock tyvm


    Wednesday, March 29, 2017 8:37 PM
  • Hello,

    High level, you need to first setup a master-detail relationship between two or more tables to properly access master data from detail data and the reverse. Once you have that you can query what you need.

    I have a base model for this in a MSDN code sample. If you decide to look at the sample I used two DataGridView controls as this was an easy way to teach how to relate a master-detail model but that doesn't mean you need to use DataGridView controls. The key is setting up the relationships the work with the data.

    I have helper (extension) methods to make it easy to relate two tables together in the code sample e.g.

    Public Sub SetRelation( _
        ByVal sender As DataSet, _
        ByVal MasterTableName As String, _
        ByVal ChildTableName As String, _
        ByVal KeyColumn As String)
        sender.Relations.Add( _
            New DataRelation(String.Concat(MasterTableName, ChildTableName), _
            sender.Tables(MasterTableName).Columns(KeyColumn), _
            sender.Tables(ChildTableName).Columns(KeyColumn) _
            ) _
    End Sub

    Taken from the code sample, I have loaded a customer and order tables and then link them from the DataSet they were loaded

    ds.SetRelation("Customers", "Orders", "Identifier")

    There is code in the main form and the backend data class showing how to get at related data also.

    In short, you need to first set the relations before going any farther.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Proposed as answer by Frank L. Smith Wednesday, March 29, 2017 11:26 PM
    Wednesday, March 29, 2017 10:44 PM
  • Hi Landon38,
    Based on your description, I suggest you to create two or more tables in the database, one is to store itemcode, itemdecs, or unitprice and others. Another is to store Sale Order number, Qty or others. You can drag DataGridView control to show all information about sale order, and use another form to add new sale order number by click button, you can use TextBox_Validated event to check if the value is greather than 1000.
    You can refer to creating ordering system with database.
    Hope it is helpful to you.

    Best Regards,
    Cherry Bu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    • Proposed as answer by Cor Ligthert Thursday, March 30, 2017 10:23 AM
    Thursday, March 30, 2017 8:26 AM
  • So i have a accdb name itemdb with table name Products and i want to subtract the value input in the txtbox8 to the field name RegBal

    so far i have this code

    Imports System.Data.OleDb
    Public Class Order
        Public conString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Landon-PC\Documents\Visual Studio 2010\Projects\Final\Final\bin\Debug\itemdb.accdb;Persist Security Info=False"
        Public con As New OleDbConnection
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            con.ConnectionString = conString
            If con.State = ConnectionState.Closed Then
            End If
        End Sub
        Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        End Sub
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                Dim sqlQuery As String = "SELECT itemdb.Products, Products.RegBal, Products.RegBal-  " & TextBox8.Text & "
                Dim sqlCommand As New OleDbCommand
                With sqlCommand
                    .CommandText = sqlQuery
                    .Connection = con
                End With
            Catch ex As Exception
            End Try
        End Sub
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        End Sub
    End Class

    i just want to correct the sqlQuery As String =



    Thursday, March 30, 2017 4:42 PM