Unable to view record from subform

navsharenavshare Member Posts: 49
Hi

I am using subform with header.I have the menu item called get details.when I click this menuitem, the subform should show data from the header as well as another table.

But when I clicked the menu item button, the subform displays the header details only and not records from another table.

But my source table and subform(which is not attached with header) show all the details.

Could anyone resolve this issue pls..

Answers

  • DenSterDenSter Member Posts: 8,305
    If you could explain with more detail we can help you. In general terms this is not making much sense to me.
  • SavatageSavatage Member Posts: 7,142
    i think more info is needed and show the code your using

    ah . denster beat me by a few milliseconds :lol:
  • navsharenavshare Member Posts: 49
    Hi...

    This is the coding for library management.When a student wants to return his book,it should show all the books which has been issued to that particular student and yet to return.

    I am able to get the details.but the duplicate entry for the last record appears.

    for ex. if a student has taken 4 books, it shows 5 books instead of 4(The details of the 5th book repeated).

    The coding has been written in the onvlaidate trigger of the student No.(in subform).

    "intlineno.":=1000;
    recLib.RESET;
    recLib.SETRANGE(recLib."No.","No.");
    recLib.SETRANGE(recLib."Transaction Type",recLib."Transaction Type"::Issue);
    recLib.SETRANGE(recLib.Type,recLib.Type::Student);
    IF recLib.FIND('-') THEN
    REPEAT
    INIT;
    Name:=recLib.Name;
    "Book ID":=recLib."Book ID";
    Description:=recLib.Description;
    "Return Date":=recLib."Return Date";
    "Line No."+="intlineno.";
    "intlineno."+=1000;
    INSERT;
    MODIFY;
    UNTIL recLib.NEXT=0;

    I hope somebody will resolve this issue.
  • garakgarak Member Posts: 3,263
    1. You need the infos only to display it for the librarian :?:
    2. Is you "subform table" temporary or not. If not, what is, when the user press 2x, 3x, 4x, the "Detail" button
    3. your "modify" after your insert is not needed, because there are no recs to modify ;-) (because you have insert these recs before)
    "intlineno.":=1000;
    recLib.RESET;
    recLib.SETRANGE("No.","No."); //The No of the Header or of a line in subform :?:
    recLib.SETRANGE("Transaction Type",recLib."Transaction Type"::Issue);
    recLib.SETRANGE(Type,recLib.Type::Student);
    IF recLib.FIND('-') THEN begin
      REPEAT
        INIT;  //here we are in Subform lines
        Name:=recLib.Name;
        "Book ID":=recLib."Book ID";
        Description:=recLib.Description;
        "Return Date":=recLib."Return Date";
        "Line No."+="intlineno.";
        "intlineno."+=1000;
        INSERT;  
      UNTIL recLib.NEXT=0; 
    end;
    

    you write, the subform is not linked (attached) with you header :?: Why :?: So, if in subform is still a record an you press the detail button, the same record will be inserted, because you have not filtered it out in your filter criteria (recLib.setfilter("Book ID",'<>%1',TheBOOKID); ). RecLib is the same table like the table in Subform or not :?:

    Regards
    Do you make it right, it works too!
  • garakgarak Member Posts: 3,263
    why do you not use for your library management, the same logic like Sales Header / Sales Line (Form 42 / 46) :?: And for your info you open a separate info form.
    Do you make it right, it works too!
  • DenSterDenSter Member Posts: 8,305
    Like the others said, you don't need any code.

    Create a list form for the recLib table, and put it on the Student Card form as a subform. On the subform control, filter the Transaction type by Issue, the Type by Student, and link the number in recLib with the Student's No. Now you should see only the lines that are linked, without a single line of code.
  • navsharenavshare Member Posts: 49
    edited 2008-07-29
    Hi..

    Thank u so much.The problem is solved now. 8)
  • garakgarak Member Posts: 3,263
    Please write [Solved] infron of your subject. Thanks ;-)

    Regards
    Do you make it right, it works too!
  • navsharenavshare Member Posts: 49
    edited 2008-07-31
    tnx
  • SavatageSavatage Member Posts: 7,142
    navshare wrote:
    The issue is solved

    Ha Ha!! No, he ment go to the first post. if you click edit you will be allowed to change the orginal post topic from

    Unable to view record from subform
    to
    (Solved)Unable to view record from subform
  • garakgarak Member Posts: 3,263
    Ha Ha, like Nelson from the SIMPSONS :sick:
    Do you make it right, it works too!
Sign In or Register to comment.