I am trying to create a EPOS system for a local small store. I have created 2 tables tblTransMain, which holds ID, Order Date, Order Time, Payment Type and Sales Clerk. This has a subform called tblTransactions, which holds all the transaction info. I have so far created a form called frmTransactions. On this for I have a command button that you enter a barcode into. What should happen is a clerk enters a barcode and on the after update event it should look at the tblProductlist table and populate the tbltransactions table. At the moment I am kinda stuck with bits of this not working. I am using the following code on the after update event:
Private Sub cmbBarcodeEnter_AfterUpdate()
' Create a Transaction in the Transactions database
Dim oRS As New ADODB.Recordset
oRS.Open "SELECT * FROM tbltransactions;", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
oRS.AddNew
oRS!OrderIdRef = 1 (For test purposes)
oRS!Barcode = Me.cmbBarcodeEnter.Column(0)
oRS!Manufacture = Me.cmbBarcodeEnter.Column(1)
oRS!ProductName = Me.cmbBarcodeEnter.Column(2)
oRS!Department = Me.cmbBarcodeEnter.Column(3)
oRS!Quantity = 1 (For test purposes)
oRS!TransType = Me.cmbBarcodeEnter.Column(4)
oRS!Discount = 0 (For test purposes)
oRS!Cost = Me.cmbBarcodeEnter.Column(5)
oRS!Total = 200 (For test purposes)
oRS.Update
oRS.Close
Set oRS = Nothing
End Sub
As you can see, this should add the data back to the table, but it only adds the orderIdRef, barcode, manufacture, quantity and total. Not quiet sure why. Is this the best method of doing this kind of transaction, or should I use a different method. If so what is suggested?
Also on form frmTransactions I have a list box that should show all the transactions for that particular order. It looks at the current OrderIdRef and displays all the queried information in the list box. This then shows all the order. Is this the best way to get the required information?
Does anyone have a sample database that I can look at?
Please see attached Database for reference. Please feel free to edit the DB and post back.
Thanks in advance for any help,
Danian
Private Sub cmbBarcodeEnter_AfterUpdate()
' Create a Transaction in the Transactions database
Dim oRS As New ADODB.Recordset
oRS.Open "SELECT * FROM tbltransactions;", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
oRS.AddNew
oRS!OrderIdRef = 1 (For test purposes)
oRS!Barcode = Me.cmbBarcodeEnter.Column(0)
oRS!Manufacture = Me.cmbBarcodeEnter.Column(1)
oRS!ProductName = Me.cmbBarcodeEnter.Column(2)
oRS!Department = Me.cmbBarcodeEnter.Column(3)
oRS!Quantity = 1 (For test purposes)
oRS!TransType = Me.cmbBarcodeEnter.Column(4)
oRS!Discount = 0 (For test purposes)
oRS!Cost = Me.cmbBarcodeEnter.Column(5)
oRS!Total = 200 (For test purposes)
oRS.Update
oRS.Close
Set oRS = Nothing
End Sub
As you can see, this should add the data back to the table, but it only adds the orderIdRef, barcode, manufacture, quantity and total. Not quiet sure why. Is this the best method of doing this kind of transaction, or should I use a different method. If so what is suggested?
Also on form frmTransactions I have a list box that should show all the transactions for that particular order. It looks at the current OrderIdRef and displays all the queried information in the list box. This then shows all the order. Is this the best way to get the required information?
Does anyone have a sample database that I can look at?
Please see attached Database for reference. Please feel free to edit the DB and post back.
Thanks in advance for any help,
Danian