The table structure looks fine but in tblGoodsInDetail the ProductPriceID
should be stored to capture the price the product was paid for. Having this
linked at table level can cause problems later if someone changes the price.
i.e. Paid $3.50 for a widget on 23 Mar 2002 and then someone decides to
change the price for a widget in the tblProductPrices to $3.75 instead of
adding a new price and date as with your table structure. This will upset
the history because all calculations will show $3.75 although $3.50 was the
price paid for that widget. Storing the price at the time of the transaction
also makes it easier when creating queries. Fewer tables are required in
your query resulting in a query that will more likely to work as you like it
to and be more updatable.
Back to your original problem. There's no need to use a query for your main
form, just use the tblGoodsIn. Use a query for your sub-form based on the
tblGoodsInDetail. To display the total price of the order in the main form,
add a text box to the Form Footer of the sub-form and in its Control Source
type =Sum([ExtendedPrice]) where the [ExtendedPrice] is the name of a
calculated field in the qryGoodInDetail query
ExtendedPrice:(Price*Quantity)+((Price*Quantity)*T axRate). In the main form,
create another unbound text box and in its Control Source reference the text
box control, = [YourSubFormName].[Form]![YourTextBoxName].
Have a look at the Orders form in the sample Northwind database that comes
with Access to help you.
Jeff
"John" <br****@gofree.indigo.ie> wrote in message
news:d4**********@reader01.news.esat.net...
That didn't display right. Here are the relevant tables. The primary and
foreign keys are self explanatory.
tblTaxRate
pkTaxRateID
TaxRate
TaxDate
tblGoodsInDetail
pkGoodsInDetailID
Quantity
fkGoodsInID
fkTaxRateID
fkProductPriceID
tblGoodsIn
pkGoodsInID
DeliveryDate
SupplierInvoiceNumber
fkCustomerID
fkPaymentID
tblCustomers
pkCustomerID
CustomerName
fkAddressID
tblProductPrices
pkProductPriceID
UnitPrice
UnitPriceDate
Markup
fkProductID
tblProducts
pkProductID
ProductCode
ProductDescription
QtyPerUnit
UnitsInStock
f kCategoryID
tblProductCategory
pkCategoryID
ProductCategory
There are other tables, but these are the relevant ones.
John