Linking Subforms?

G

GB

Ok - I might be going about this completely the wrong way, but here goes!

I have an order entry Database - Access 97

I have form [Orders] that has 2 subforms on it.

First is [Order_Detail] which has default view of 'single form', this allows
the user to enter the product, qty, price, etc.

Secondly at the bottom of the [Orders] form I have another subform
[Order_Detail_Items] that has a default view of 'datasheet'.

The idea behind this is that the user can see a running total of the items
entered via the [Order_Detail] form.

PROBLEM

Firstly the [Order_Detail_Items] form doesn't update automatically when I
click the 'Add new item' button (basically enters a new line on the order)

Secondly I would like to be able to click in the [Order_Detail_Items] form
and have all the item info displayed in the [Order_Detail] subform - but it
doesn't link back!!!

Help, how do I do this? Is this possible?

Many thanks,

Graeme
 
J

John Vinson

Firstly the [Order_Detail_Items] form doesn't update automatically when I
click the 'Add new item' button (basically enters a new line on the order)

Requery the second subform in the first subform's AfterUpdate event:

Parent![Order_Detail_Items].Requery
Secondly I would like to be able to click in the [Order_Detail_Items] form
and have all the item info displayed in the [Order_Detail] subform - but it
doesn't link back!!!

You need to put code in the OnClick event of *some* control on the
Order_Detail_Items subform, and click that control. The code would be
a bit complicated: you'ld need to grab the Primary Key value of the
selected record, setfocus to the Order_Detail subform, open its
Recordsource, find that ID, and set the subform's Bookmark to the
found record... a bit more code than I can type in right now! Hope
this gets you started.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top