View Full Version : Append Query


somewho
09-05-2009, 07:46 PM
Hello.

I have a table to keep track of the inventories of a specific product in a specific store that looks like this :

[product_inventories]
product
store
quantity

I want that if a user create a new product and/or a new store, inventory data for each product should be automatically added for each product/store available.

For example :

Data in [products] table :
Apple
Banana

Data in [stores] table :
ABC
XYZ

User create a new "Mango" product, so these inventory data should be automatically added :
Mango / ABC / 0
Mango / XYZ / 0

How can I do this with an append query? Or should I use something else? I'm pretty new to access and VB. Oh, and I'm using MS Access 2007.

Thanks before...

wiklendt
09-06-2009, 05:01 PM
sounds like you just need a bound form of your product (or location) with a subform for your junction table.

i presume your junction table (product_inventories) has the two fields as 'number' type. so, in your form, when you add controls for the products and stores, you bind them to these fields, but have a combobox for each, whose source data are the other two tables.

does that make sense to you?

edit: forgot to say, because your forms will be bound, each time you select a new combination of product/store, access will automatically create and save that new record for you - no code required!

neileg
09-07-2009, 01:01 AM
You don't need to crreate a record for a nil inventory. Only create a record when you have something, which is what winklendt is saying.