Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie question (Forms), Please help. :)

Status
Not open for further replies.

jmswe

Programmer
Feb 14, 2002
31
GB
Hi!

Im trying to set up an order system (not really but the mechanics are the same). I have an order (main form) and a subform. On the subform i want to be able to select the products (when i select one i want an empty line to appear) the prouct info should then be collected from the "products" table...

I have looked at the templates but the y are darn complex so cant draw much conclusions from then. :)

/John
 
I'd like a little clarification before I try to answer this one. Tell me if this is what you mean:

You select a product on the subform, the main form populates with a line showing the product you just selected.

I know you said a blank line, but I don't understand what that would do. Where does the blank line appear, sub or main?
When you collect the information from the 'products' table...what happens to it? Does it go in the blank line?
Sorry to barrage you with questions, but I think I got this one figured out, but don't want to misunderstand the situation. Young Programmer: But, sir, the users are revolting!

Old Programmer: They've always been revolting, now they're just rebellin'!
 
In most, not all, instances, subforms are used to review/change/add/delete records that are in some way related to the table underlying the main form. Your order system is a perfect candidate for a primary and subform configuration.

For example, your order master table is going to have specific information about the order, like person/company ordering, order date, date promised, etc.

You also need a product table which provides information about the products you sell.

You also need a products ordered table which has one record for each product ordered for each order. Therefore you have a relationship between the order table and the products ordered table.
Each table should have a unique primary key. The primary key from the order table is used as a forward key and is placed in the products ordered table.

Now, your primary form has a subform container object. This is the object you create when you allocate space on your primary form. That container has properties. If you click on the subform container in the primary form and then click on properties, you will see a master/child field name.
The master relationship is the primary key of the order form, and the child key is the forward key of the products ordered table.

So, when you open the primary form, whatever records from the products ordered table have a forward key which match the primary key of the orders table, will appear in the subform. You can add more records, edit and delete records from the subform.

That should get you started. You might want to pick up a good intermediate text for Access which should have a good explanation of table design, and developing forms and subforms.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Yes!!

That bit with the relationship cut the mustard!

I got it working just fine. :)

Thanks a lot to both of you for you help.

Regards

/John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top