How can I create a Sales form that can update both the Product and Sales Tables

How can I create a Sales form that can update both the Product and Sales Tables

Post by Bill_ekit » Fri, 12 Oct 2007 18:31:55


Am creating a Product-Sales Database, and I would like the corresponding
Sales made in the Sale Table to be automatically deducted or to be reflected
in the Product Table. The product table contains all my stock and has a
relationship with the Sales Table. The Sale Table does not necessarily
include the Stock. How can I create possibly a Sales Form that will be used
as an entry point for all the products (stock) sold and automatically
register the sold products in the Sales Table and at the same time make the
required adjustments in the Products Table.

------------------------------------------------------------------------------

--
Message posted via http://www.yqcomputer.com/
 
 
 

How can I create a Sales form that can update both the Product and Sales Tables

Post by Arvin Meye » Fri, 12 Oct 2007 21:19:04

Create a combo box using a rowsource from the product table and bound to the
Product ID in the Sales table, as you choose a product you will be entering
it in the Sales table. To determine inventory levels write a query linked on
the product ID from both tables. Subtract the total quantity in the Sales
table from the total quantity in the Products table. You can base a form or
report on that query. You can use a DLookup to that query to display the
inventory level on the Sales form.
--
Arvin Meyer, MCP, MVP
http://www.yqcomputer.com/
http://www.yqcomputer.com/
http://www.yqcomputer.com/

 
 
 

How can I create a Sales form that can update both the Product and Sales Tables

Post by Bill_ekit » Fri, 12 Oct 2007 23:18:29


Hi Arvin Meyer for your contribution! I'll try it out and keep your post! Kit

--
Message posted via AccessMonster.com
http://www.yqcomputer.com/
 
 
 

How can I create a Sales form that can update both the Product and Sales Tables

Post by Bill_ekit » Fri, 12 Oct 2007 23:19:00


Hi Arvin Meyer,

Thanks for your contribution! I'll try it out and keep your post! Kit

--
Message posted via AccessMonster.com
http://www.yqcomputer.com/
 
 
 

How can I create a Sales form that can update both the Product and Sales Tables

Post by Bill_ekit » Fri, 12 Oct 2007 23:23:00


--
Message posted via AccessMonster.com
http://www.yqcomputer.com/
 
 
 

How can I create a Sales form that can update both the Product and Sales Tables

Post by Bill_ekit » Sat, 13 Oct 2007 00:31:09


Hi Arvin

Thanks so much! Could you kindly paraphrase for me this: "...using a
rowsource from the product table and bound to the Product ID in the Sales
table..."

Well, assuming that we've got both the PRODUCTS Table and the SALES Table,
and the SALES Form that is going to act as an Interface. All the Inventory is


already entered and saved in the PRODUCT Table. The SALES Table is only
keeping track of the sold products (items) from the PRODUCST Table. Well, at
a later stage we shall deal with Totals, but at the moment let us focus on
RECORDS in the PRODUCTS Table. For instance, we've 50 Intex keyboards in a
PRODUCTS table as a RECORD (row). Though we might have the same FIELDS in
the SALES Table.The SALES Table only

handles products that are sold. In this case, using the SALES Form, we want
to sell 3 keyboards. These 3 keyboards sold are registered/reflected in the

SALES Table and automatically they are subtracted from the PRODUCT Table,
hence having 47 keyboards in the PRODUCTS Table!

Thanks, Kit

--
Message posted via AccessMonster.com
http://www.yqcomputer.com/
 
 
 

How can I create a Sales form that can update both the Product and Sales Tables

Post by Arvin Meye » Sat, 13 Oct 2007 01:01:33

I prefer to also have a Purchases table. Instead of trying to keep inventory
in one place where multiple people could easily make changes. It also gives
me the opportunity to maintain more than 1 supplier for each product. Total
of purchases - total of sales = product inventory.

If you wish to have the inventory maintained in the Products table, use an
update query in the AfterUpdate event of the form. Something like (Aircode,
substitute your table, field, and control names):

Sub Form_AfterUpdate()
On Error GoTo Error_Handler
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String

strSQL = "Select * From tblProducts Where ProductID =" & Me.txtProductID

Set db = CurrentDB
Set rst = db.OpenRecordset(strSQL, dbOpenDynaSet)

With rst
.Edit
!ProductID = !ProductID - Me.txtSalesQty
.Update
End With

Exit_Here:
rst.Close
Set rst = Nothing
Set db = Nothing

Error_Handler:
MsgBox Err.Number
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
http://www.yqcomputer.com/
http://www.yqcomputer.com/
http://www.yqcomputer.com/
 
 
 

How can I create a Sales form that can update both the Product and Sales Tables

Post by Bill_ekit » Sat, 13 Oct 2007 02:22:41


Thanks a million Arvin!
I'll give it a shout and keep you posted! Kit

--
Message posted via AccessMonster.com
http://www.yqcomputer.com/