Options

Moving form record based on subform record selection

jksjks Member Posts: 277
Hi all,

My form contains one subform. Source table for form and subform is same. suppose table name is 'Test'.
Table 'Test' contains 10 records. Detail of each record i am displaying on form and all the records i am displaying on subform.(with some important field of table 'Test')
What i want is whenever i point a particular record in a subform, detail information of that record should get displayed on the form. For that I have created one function in my form i.e. moverecord. I have handled OnAfterGetCurrRecord trigger of subform. My code is below:

OnAfterGetCurrRecord() [Event of subform]
dong.moverecord(value);


dong is a variable of type Form.

moverecord(value : Integer) [Function on form]
dongrecord.get(value);
Rec:=dongrecord;


value is the value of primary key.

But record doesn't move. If i write
dongrecord.get(//Some Constant value of primary key)
Rec:=dongrecord;
in OnAfterGetCurrRecord trigger of form then i am getting the record.

Please help.

Comments

  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Hi,

    Have you tried to put a tablebox and a tab control on the same form?

    You can then browse through the records and view detailed information at the same time.

    Just take a card form and add a table box to it, and see the results.
  • Options
    jksjks Member Posts: 277
    I placed a table box on a card. and assigned id of the table box to TableBoxID property of a form. But table box is not populated with the data.
    Do i need to set some other properties?

    I searched forum. but was unable to find the solution.

    Please help.
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Just add the fields like you normaly do when you add columns to a tabular form. Use the field menu.
  • Options
    Peter_WijntjesPeter_Wijntjes Member Posts: 28
    - Start Object designer.
    - Create New Form
    - Select Table Name : I.e. Sales Header.
    - Check Create Form Using a wizzard and select Create Tabular Type form
    - Select the fields u want in the list.
    - Press Finish.

    - Now your are in screen design mode.
    - Increase the heigth of the screen.
    - Move the table box to the bottom.
    - Go to field menu, select fields you want to add to the detail.

    Press CTRL+R et voila \:D/

    If you do not have enough room for all detail fields simply drop a TabControl first...

    Have fun!

    Peter
    Peter Wijntjes
    MBS NAV Consultant
  • Options
    jksjks Member Posts: 277
    Hi all,
    It works perfectly. But in the current situation , my subform is linked with my form with some condition. i.e my subform and form both display only those records where userid="test" . How can i achieve this with table box?
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    You can just put this in the sourcetableview property or add it to the OnOpenForm in code.

    Just remember the same code and properties go for the normal fields and the tablebox.
  • Options
    jksjks Member Posts: 277
    It works perfectly now.
    Thanks for your replies.
Sign In or Register to comment.