Good afternoon all,
I am in the process of creating a database in which I want to enter a product name and a dose and a price will be returned. I have created two tables (tbllog and tblcosting). The tblcosting contains the products along with all the available doses and the prices they cost. Is there a way of inputting the product and dose onto one form and having a box that returns the price based on these two criteria?
Any advice you could pass on would be very much appreciated.
Select product from a combobox. Make the combobox RowSource multi-column:
SELECT ProductID, ProductName, Dose, Cost FROM tblCosting ORDER BY ProductName;
Have textboxes reference the combobox columns by index to display the associated info. Index begins with 0 so Cost is in column index 3:
=[cbxProduct].Column(3)
Related
While im not new to databases, i am out of practice and was wondering how to create a total price attribute for a store database.
The table has the attributes: PT KEy, Product ID, Quantity, offer, Total item price(the product table has the prices, this field is just the price multiplied by the quantity), offer.
I am trying to make a field that adds up all the Total item prices in the table, giving the entire price of the transaction.
Should i make this field in another table or do it in the current one? if so how?
So in the end i made it a calculated field in that was generated in a query. I removed any calculated fields of the such and replaced them in the queries.
So, lets say I have 3 tables.
First table is the product table where it consists of
Prod_code, Prod_name, Prod_qty, Prod_Price1, Prod_Price2.
The second table is the Order table where it consists of
Order_ID, Order_Date, Total_price.
And the last table is the order detail table which consists of
Order_Detail_ID, Order_ID (foreign key from order table), Prod_code(foreign key from Product table), Qty_Ordered, and Price
If you can see I have 2 prices for each product in the product table for the purpose of:
If the Qty_ordered from the order detail table is greater than 10 unit, then the Price column in the order detail given will be Prod_price2
If the Qty_ordered from the order detail table is equal to or less than 10 unit, then Price column in the order detail given will be Prod_price1
How can I make this happen so when I create an order detail form, it can automatically give me the Product price based on the Qty_ordered that I input?
I believe this could require some if statements in the query but I'm a novice in Ms. Access and I need you guys' help. Thanks a lot
In a query that joins Orders and Products to OrderDetails, calculate a field with:
IIf(Qty_Ordered <= 10, Prod_Price1, Prod_Price2)
If you need to display this on data entry form bound to OrderDetails, build a combobox that lists products and has both prices as columns (can be hidden if you want). An expression in textbox can reference columns of combobox by their index. So if Price1 is in third column its index is 2.
=IIf(Qty_Ordered <= 10, Me.cbxProduct.Column(2), Me.cbxProduct.Column(3))
Saving this calculated result will require code (macro or VBA) in some event, probably form BeforeUpdate.
Me!Price = Me.tbxPrice
I'm building a small inventory database in MS Access (2007), and I have one big dilemma: Should I store purchased (acquired) products/quantities in the same table as sold, with a field for transaction type, or should I separate them in two tables?
I'm working on second option now, but I'm stuck on querying these two tables.
tblProducts: ProductID (PK), ProductCode, ProductName
tblVendorsCustomers: VndCstID(PK), VndCstName, etc..(Vendors can also be Customers and vice-versa)
tblPurchase: PurchaseID(PK), PurchaseNumber(specific), VndCstID(FK), DatePurchased, DueDate
tblPurchaseDetails:PDetailsID(PK), PurchaseID(FK), ProductID(FK), QuantityPurchased, PricePurchased
tblSale: SaleID(PK), SaleNumber(specific), VndCstID(FK), DateSold, PayDate
tblSaleDetails: SDetailsID(PK), SaleID(FK), ProductID(FK), QuantitySold, PriceSold
Two tables (Purchase, Sale) are updating fine. Now, for example, when I want to show a report for a chosen Product, I need to pull data from these two tables, to see purchased quantity (along with Vendor name, date of purchase, and price) and sold quantity (with same set of data) and to calculate available quantity (at a given date). Maybe I'm missing something, but the only way to do this is create two select queries (for each of these tables), than union of these (to pull all transaction data), then a select query of that union, add an identifier field (for row from purchases and row from sales) and criteria for product selection..and I'm stuck on calculating available quantity..I'm guessing sum IIf, but not sure how to use it..
Sorry for such a long post...
Is this the right approach?
Any help or advice would be appreciated.
Table1 feildes
Product{ID,Product,Quantity(in peices),Cost(per peice)}
table2
Customer{ID, Name, Type(local,sale's man)}
table 3
customer order{ID, date,customer*, product*,quntity,price}
here customer is coming from table 2 named as customer while product is coming from table1 named as products
i just want to show remaining items in order table. any can help me to make this happen?enter image description here
You mean you want to know how much of each product remains after filling orders? This is calculating inventory balance - a common topic. You need a table that records receipt of product, which is apparently your Products table but I think would be better titled ProductReceived. Do an aggregate query on ProductReceived and an aggregate query on Orders then do another query that joins the two and subtracts the latter from the former. Customer table not needed for this. Products table would just be a lookup table for product info - no Quantity or Cost fields as these belong in ProductReceived. Products table should have the selling price you want to charge.
You have misspelled 'piece' in your field names.
Advise no spaces, punctuation, or special characters in field names (underscore is only exception). Better would be Qty_Pieces.
Is it possible to build an unmatched data query using two tables with a tracking a unique value field and also another value in the row as well (that value will not be unique).
For example I want to track a unique customer code from an invoice on a new table, compared to last month's invoice. The non unique value would be a "product code" of what they purchased.
A customer code could appear multiple times depending on if they have purchased multiple product codes.
Any help is much appreciated.
This should do what you want:
SELECT Invoice.CustomerID
FROM Invoice LEFT JOIN PreviousInvoices
ON (Invoice.Product = PreviousInvoices.Product)
AND (Invoice.CustomerID = PreviousInvoices.CustomerID)
WHERE PreviousInvoices.Product Is Null