Following my question what code do I need in a Base macro to access a field in highlighted row in a datasheet I received excellent code from Ratslinger which answered my question. I now have a further question based on that code.
I have altered the form ‘Customers’ so that it not only displays information about that customer but also contains a subform grid, In which details about all the items sent to that customer are displayed. This subform is based on a query into two tables, one listing all the items it is possible to send (with a primary key ItemsID ) and the other listing all the possible customers ( with the primary key CustID). I open the form by highlighting a particular postage in another form - say the postage of itemID = 5 (coffee) to CustID = 2 (Mr Smith). The form ‘Customers’ shows details about Mr Smith (his telephone numbers and addresses) and also in the subform the items he has been sent (row 1: cakes; row2: butter; row 3: coffee; row 4 milk).
All of this I have written and tested and it seems to work perfectly. When I highlight the row in ‘Postage’ the macro picks up the CustID and opens the form ‘Customers’ which contains also displays the Query showing the items this CustID received.
What I am trying to do is to modify the code further so that the row in the subform grid which says Mr Smith received coffee is highlighted. I want this highlighted because it was this that originated my search.
I think I need to do a couple of things:
First I must pick up the ItemID along with the CustID in GetCustID(). I presume this will be
oObj2 = oControl.getByName(“itemID”)
iItemID = oObj2.getCurrentValue() - where iItem is global.
Secondly I must highlight this item in the subform grid by modifying OpenFormAt Record().
Any help identifying the appropriate alterations would be much appreciated because I’m not making any progress:(