Refresh Dlookup data in the active row of a datasheet after modifying data

Difficult to explain - so I will give you my scenario -I have three tables Student, Home Room and Teacher - the Student is linked to a home room and the home room is linked to the Teacher. In my form using Student, I show the student, the home room and the
Teacher for that home room. (The student file has the HomeRoomID in it). I show the teacher by looking up the teacherID using the HomeRoomID (using Dlookup on the HomeRoom table to get the teacherID), save it to a textbox IDTeach. Using another Dlookup on
the Teacher table using  IDTeach I get the teachers name in a textbox call TeacherLast 
Works fine! - however if the home room is changed, using a combobox, the teachers name does not change -it does change if the data is refreshed (The HomeRoomID in the Student Table is of course changed)
My goal is to have the teacher name change in the row where the  when the homeroom is changed.
I went to the Event - after Update on the combo box and  tried to update the teacher ID and teacher name by using
Private Sub HomeRoom_AfterUpdate()
    Form![IDTeach] = DLookup("[TeacherID]", "Home Rooms", "[HomeRoomID]=Form![HomeRoomID]")
    Form![TeacherLast] = DLookup("[Last]", "Teacher", "[TeacherID] = Form![IDTeach]")
End Sub
But this doesn't work (Run time error 2448) because, I believe, it is trying to update all the rows in the datasheet.
Is there some way to qualify these statement to only work on the current row like
Form.currentrow.IDTeach = DLookup("[TeacherID]", "Home Rooms", "[HomeRoomID]=Form.currentrow[HomeRoomID]")
or is there and easier way (or anyway for that matter)?
Thanks

There is a 1 to 1 relation between the student and the teacher -  a 1 to 1 relation between the student and the home room,  but a 1 to many relation between the teacher and the room.
Surely not?  It would be a very exclusive educational establishment where every student had their own personal teacher, and their own personal room.  A one-to-one relationship type between Teachers and Rooms is understandable, but is not the relationship
type between Rooms and Students one-to-many?  The relationship type between Teachers and Students would also be one-to-many of course, but no enforced relationship needs to be created for this as it is implicit in an enforced relationship between Rooms
and Students.  Diagrammatically the model would be:
Teachers----Rooms----<Students
A form simply needs to be based on a query which joins the three tables in this way with editable controls bound to the columns from Students and a read-only control bound to the Teacher column from Teachers.  The control bound to the foreign key Room
column in Students would be a combo box.  Once a room is selected the Teacher for that room would automatically show in the read-only text box bound to the Teacher column.
To make a control read-only BTW set its Locked property to True and its Enabled property to False.
Ken Sheridan, Stafford, England

Similar Messages

  • Copy a certain row of data into the next row in a same internal table ??

    HI, guys.
    May i know how to copy a certain row of data into the next row in a same internal table ?? Bcz I plan to update a certain colum of data in the row just now into another value..
    For example:-
    *at first...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln3   ebelp3   xblnr3
    *after that, become...
    ebeln1   ebelp1   xblnr1
    ebeln2   ebelp2   xblnr2
    ebeln2   ebelp2   xblnr4
    ebeln2   ebelp2   xblnr5
    ebeln3   ebelp3   xblnr3
    Thanks in advance.

    hi,
    If you have this kind of requirement then you must be having 2 internal tables ,one existing data and 2nd from which you have to insert the records into 1st table.
    so in this case,
    loop at itab1.
      v_index = sy-tabix.
      loop at itab2 into wa where pri_key = itab1-pri_key.
      v_index = v_index + 1.
      insert  wa into itab index v_index.
      endloop.
    endloop.
    Using this code ,your data records similar to your 1st tables primary key records will get inserted into table.

  • No data in the activity monitor

    All of a sudden I don't have any data in the activity monitor. Here's what happened. I was using safari viewing online pictures. I kept getting the rolling ball between pictures and noticed that safari was using 100%+ in processor usage and safari seemed slow. So I rebooted and opened the activity monitor and no data shows up. I run a quick hardware test and all pass. I havn't gone back to the pictures yet but normal browsing seems to be fine. I watch a few 1080P trailers and they work fine too.
    All ideas on why the monitor doesn't show data?
    Ray

    Hmm...let's try this:
    Go to User/Library/Preferences and drag the com.apple.ActivityMonitor.plist file to your Desktop. Then try launching Activity Monitor again to see if that makes anything show up. If so, then it was a corrupted preferences file, and you can then trash the one on your Desktop.
    If that doesn't solve the problem, the only thing I can suggest is to Trash the application and the preferences file, then reinstall it from your 10.4 DVDs.
    Mulder

  • Gantt view - multiple dates in the same row

    Hi,
    I created gantt view showing employees' vacations. Some of them have their holidays split into several dates (periods). How can I show those multiple dates in the same row in the gantt view? I can only show start date and end date of one vacation, but would
    like to enter multiple periods to be shown in the gantt view, in the same row.
    Thanks.

    You can't using the OOTB gantt chart so you would have to look at custom development or 3rd party web parts.
    Such as (blatant plug but it directly answers the OP question) my own companies Planner web part.
    http://www.pentalogic.net/sharepoint-products/planner
    The By Category view puts timelines on the same row so its ideal for things like vacation planning, room booking etc.
    This page shows it in use.
    http://blog.pentalogic.net/2010/08/sharepoint-staff-vacation-planner-absence-wall-chart-dashboard/

  • I'm typing dates across the top row. I want the date to be 12/13 and the program changes it to Dec. 13. It is making me mad. How do I get it to stop doing the change? I want a numerical number.

    How do I get the numbers program to type a numerical date across the top row? It wants to change it to Dec. 13 instead of 12/13.

    Amy,
    I hope that you can forgive Numbers for converting the date you enter as 12/13 into the default format of "December 13, 2011", one that is popular with many users.
    You can change to any of the supported date formats by using the Cells Inspector, Date and Time options.
    Select the top row of cells and use the inspector to set the format. You may do this before or after making the entries.
    Jerry

  • Pie Chart Only Displays the Data of the First Row of the Table

    Hi Experts,
    I have a problem that the pie chart will not change when click on a second row or other rows on the table. It only displays the data of the first row of the table. How can I set up to make it reflect on any rows when I click the table? Please help, and I would very appreciate that.
    Thanks,
    -Don

    Thanks a lot for your response. I have realized that the pie chart behaves that way, so I just use the filter to see the specific data that I want. Also, you can drag the row and drop it right at the first row to see the data in the pie chart.

  • Unable to refresh page when insert the first row in viewobject

    I am using JDeveloper 10g to develop a JSP page, DataAction, AppModule and ViewObject. But when I am trying to use the following code to insert the first row, the page is not getting refresh. The quite weird thing is when I insert the second row, it returns me the first row as well as the second row. And it works well when I am trying to insert the third row, forth row....
    //code in AppModule
    ViewObject vo= this.getSampleView();
    vo.insertRow(newRow);
    vo.setNewRowState(Row.STATUS_INITIALIZED);
    vo.setAttribute("STR1", str1);
    vo.setAttribute("NUMBER1",new NUMBER(1));
    vo.setAttribute("STR2", str2);
    getTransaction().postChanges();
    getTransaction().commit();
    //Note: SampleView is a simply view created from a EnityObject mapping to a single table.
    Anybody could help me? Thanks very much!

    //The following code is the method in AppModule, which is invoked when clicks on the Add Remarks button on web page.
    public void addRemarks(String strCustCode,String strRemarks,String strUserID)
    ViewObject voRemarks1 = this.getCrmCustomerRemarksView();
    ViewObject voRemarks2 = this.getCrmCustomerRemarksView();
    NUMBER newSeq = new NUMBER();
    try
    voRemarks1.setWhereClause(" CRM_CUST_CODE ='" + strCustCode + "'");
    voRemarks1.setOrderByClause(" CRM_SEQ_NO DESC");
    voRemarks1.executeQuery();
    if (voRemarks1.getEstimatedRowCount()<1)
    newSeq = new NUMBER(1);
    else
    Row row = voRemarks1.first();
    NUMBER seq = (NUMBER)row.getAttribute("CrmSeqNo");
    newSeq = seq.add(new NUMBER(1));
    SimpleDateFormat tmpLocalFormat = new SimpleDateFormat();
    Date tmpDate = new Date();
    tmpDate = Calendar.getInstance().getTime();
    tmpLocalFormat.applyPattern("yyyy-MM-dd");
    System.out.println("NGNCM003 add Remarks with " + strCustCode + "," strRemarks "," + strUserID);
    Row newRow = voRemarks2.createRow();
    voRemarks2.insertRow(newRow);
    newRow.setNewRowState(Row.STATUS_INITIALIZED);
    newRow.setAttribute("CrmCustCode", strCustCode);
    newRow.setAttribute("CrmSeqNo",newSeq);
    newRow.setAttribute("CrmCreatedBy", strUserID);
    newRow.setAttribute("CrmRemarks", strRemarks);
    newRow.setAttribute("CrmLastModifiedBy", strUserID);
    newRow.setAttribute("CrmCreationTimestamp",tmpLocalFormat.format(tmpDate));
    newRow.setAttribute("CrmLastModificationTime",tmpLocalFormat.format(tmpDate));
    getTransaction().postChanges();
    getTransaction().commit();
    catch (Exception ex)
    throw new RuntimeException("Invalid Sequence No.");
    }

  • How to insert data to the specified row column of the multi column list box

    Hi All
    How do i insert data into the specified column of the multi cplumn list box?
    I have a table that containsall station nos and name.Then another table contains the data the various stations having at  for 24 hrs.That is 12 am to 11 pm.
    And i want to display each stations details as follows using a multi column list box/table
    My stationinfo table
    stnno   stnname......................
    s1           stn1
    s2            stn2
    s3             stn3
    The other table
    stnno      sysdatetime       data
    s1             12am                   1
    s2              12am                   4
    s1               1  am                 2
    So the station s1,s2.... will have data for 24 hrs.
    And i want to display it as follows using a multicolumn listbox
    stnname        12am   1 am ......................................11pm
    s1                   ...................
    s2                 ........................
    What i have in my  mind is to get all station nos
    and in a for loop get the station's data from 12 am to 11 pm
    or
    select every statios data for each hor.But in this case i have to query the database 24 times.So i dont think its a good way.
    Or any other better query available?
    Can anybody suggest me a good idea?
    One more thing...how to insert data into the specified field row or column of a multi column list box?
    Thanks in advance

    hi
    i want to know,,can u say ur need clearly...and i attached two image u see that one
    Indrajit
    | [email protected] | [email protected] .
    Attachments:
    station.JPG ‏35 KB
    station2.JPG ‏79 KB

  • Showing data for the first row only

    Oracle Experts ,
    Below is my table in oracle.I wnat show Company ID only for the first row of each company. Table 2 is my output .
    Company Country Company ID
    BARCALAYS UK 1
    BARCALAYS USA 1
    BARCALAYS Australia 1
    Kingfisher UK 2
    Kingfisher INDIA 2
    Kingfisher INDIA 2
    Output Table 2 :
    Company Country Company ID
    BARCALAYS UK 1
    BARCALAYS USA Null
    BARCALAYS Australia Null
    Kingfisher UK 2
    Kingfisher INDIA Null
    Kingfisher INDIA Null
    Please give me a sql query.
    Many thanks in advance .
    Regards,
    Dirasa

    based on if a particular country is appearing twice for the same company and company_id wether to show the company_id for that country or not you may use any of the below queries :)
    /* Will show compan_ID twice if the country is repeated */
      with x as (
          select 'Foo' company_name, 'UK' country, 1 company_id from dual
          union all
          select 'Foo', 'USA', 1 from dual
          union ALL
           select 'Foo', 'USA', 1 from dual
           UNION ALL
          select 'Foo', 'AUS', 1 from dual
          union ALL
        select 'Foo', 'AUS', 1 from dual
          union all     
          select 'Bar', 'UK', 2 from dual
          union all
         select 'Bar', 'USA', 2 from dual
         union all
         select 'Bar', 'India', 2 from dual
    SELECT company_name,country,CASE WHEN rn=1 THEN company_id ELSE NULL END company_id
       FROM (SELECT
       company_name,company_id,country,rank()over(PARTITION BY company_name,company_id ORDER BY country) rn
        FROM x)
    /* Will NOT show compan_ID twice even if the country is repeated */   
      with x as (
          select 'Foo' company_name, 'UK' country, 1 company_id from dual
          union all
          select 'Foo', 'USA', 1 from dual
          union all
          select 'Foo', 'AUS', 1 from dual
          union ALL
        select 'Foo', 'AUS', 1 from dual
          union all     
                 select 'Foo', 'USA', 1 from dual
           UNION ALL
          select 'Bar', 'UK', 2 from dual
          union all
         select 'Bar', 'USA', 2 from dual
         union all
         select 'Bar', 'India', 2 from dual
    SELECT company_name,country,CASE WHEN rn=1 THEN company_id ELSE NULL END company_id
       FROM (SELECT
       company_name,company_id,country,row_number()over(PARTITION BY company_name,company_id ORDER BY country) rn
        FROM x)
    /* Will show compan_ID twice if the country is repeated */
      with x as (
          select 'Foo' company_name, 'UK' country, 1 company_id from dual
          union all
          select 'Foo', 'USA', 1 from dual
          union ALL
           select 'Foo', 'USA', 1 from dual
           UNION ALL     
          select 'Foo', 'AUS', 1 from dual
          union ALL
        select 'Foo', 'AUS', 1 from dual
          union all     
          select 'Bar', 'UK', 2 from dual
          union all
         select 'Bar', 'USA', 2 from dual
         union all
         select 'Bar', 'India', 2 from dual
    SELECT company_name,country,CASE WHEN rn=1 THEN company_id ELSE NULL END company_id
       FROM (SELECT
       company_name,company_id,country,dense_rank()over(PARTITION BY company_name,company_id ORDER BY country) rn
        FROM x)
                    Cheers!!!
    Bhushan

  • I can't pass the activation on my iPhone 4 after I've updated on iOS 7

    Hello!
    After I've up-to-date my iOS version to 7.0.4, my phone can't pass the activation as it requares appleID of the previous owner. Today I have no contact with this guy. This iPhone was purchased with the conclusion of a social contract. Serial number on the box coincides with serial in settings of the phone.
    Please help me with this unpleasantness.

    Welcome to the Apple community.
    Unfortunately, you cannot do very much with your phone unless you get assistance from the previous owner, they should either provide you with the password to unlock it or remove their account from the phone entirely remotely through iCloud.com > Find My Phone.

  • Select with timestamp in the where-clause don't work after importing data

    Hello,
    I have to databases (I call them db1 and db2, they have the same datastructure) and exported some data from the table "rfm_meas"from db1. Later on I imported that dataset into the "rfm_meas"-table of db2. The table contains a col with the datatype "timestamp(6)" and checking the success of the import looks fine:
    (executed on db2)
    SELECT
    id,acqtime
    from
    rfm_meas
    WHERE
    box_id=1
    AND id>145029878
    Returns two rows:
    ID ACQTIME
    145029883 01.06.10 10:30:00,000000000
    145029884 01.06.10 10:50:00,000000000
    It seems there are valid timestamps as I expected.
    But if I now want to select all rows from box_id=1 which are newer than e.g. 25-may-2010 I would try this:
    SELECT
    id,acqtime
    from
    rfm_meas
    WHERE
    box_id=1
    AND acqtime>=to_timestamp('25-05-2010 17:10:00,000','DD-MM-YYYY HH24:MI:SS,FF3')
    And it returns ... nothing!? If I execute the same query on db1 it works correctly.
    I guess db1 and db2 has different codepages!?
    If I insert some rows from a PL/SQL script in db2 into the "rfm_meas"-table, querys like the one above works fine. Therefore i guess, during importing the data there must be something wrong, so I cann see the timestamp, but can't use it.
    How can i fix that? Any ideas?
    If someone need more details I will provide it.
    Regards
    Steffen

    check this link out
    Importing timestamp columns appears to use to_date instead of to_timestamp

  • Field should not display in the subtotal row in ALV report after sorting .

    we have a requirement, after sorting and subtotaling, the output in ALV is -
    vbeln        amount1  amount2  amount3
    123           11              12            13
    123           12             13             14
    123           23             25             27 
    133           11              12            13
    133           12             13             14
    133           23             25             27
    Now the customer wants the ALV outpput in this fashion -
    123           11              12            13
    123           12             13             14
                     23             25             27    --->123 (vbeln) should not come in subtotaling row
    133           11              12            13
    133           12             13             14
                      23             25             27--->133(vbeln) should not come in subtotaling row

    Hi,
    if it helps you could create a hierachy. In this way you can define the field catalog for the lines and for the subtotal columns. The only thing is that you would always show the subtotal rows.
    You have references of hierachy alvs in
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f
    ALV Hierarchy
    alv hierarchy
    In this case it also sorts
    Sorting for ALV hierarchy
    I hope it helps.
    Edited by: Oscar Pecharroman on Aug 2, 2010 1:13 PM

  • End Date of the Selection Period defaults as tax year end date in P45

    Hi,
    We have recently implemented both HRSP'S and CLC'S. In addition to this, we have also applied the following SAP Notes:
    1. 1305238
    2. 1309852
    3. 1310431
    4. 1316197
    Despite this, we are still having the below problem with the P45 Program.
    The End Date of the Person Selection Period automatically defaults to the end of the tax year, we are now unable to overide the date suggested by the system.
    Can anyone suggest the cause of this issue.
    Rgds
    Sandy

    Hi,
    With the Inyear movement legal changes ,HMRC have now introduced a check where in P45 cannot be produced for leavers who have a future leaving date 30 days from the current date.
    In line with the above changes,the chance of issuing P45 for future leavers is now checked by the P45 program even though the person selection end date is the tax year end date . So that's why the date is getting defaulted from the tax year.
    Hope this could solve your issue.
    Regards
    Roop

  • How to get data on the next page in case of templates if data is more ?

    please tell me how to get data on the next page while i m using template in my first page , if data is more howw it can be displayed on the next page ?

    HI Asim,
    template is fixed we  it can't be expand . u can better to use table line it can automaticlly expending if data is more ... u can create one more page like page 2 and create a window for entire second page ..then assign it in first page (next page page2).
    regards
    kiran kumar.

  • Selecting The First Row Of h:dataTable after getting new DataModel f

    Hi Friends
    If any one knows how to select first row of a dataTable on change of a DataModel it is representing please give the reply

    I haven't understood the answer of UlrichCech
    I am not using IRDA for my development purpose.
    and abt your reply ..
    I have already tried tht way but the problem is that
    whenever I selects different row page gets postback and selects
    the first row again and there is no way to trap posback event in JSF
    like ASP.NET
    I think my answer is some where related to DataModelListener..

Maybe you are looking for

  • Audiobooks - sharing between computers on same account

    Hey guys, I have various audiobooks that are in my home laptop. I'd love to listen to them at work, on my work computer, like i do with my music. But for some reason they do not seem to want to sync. I'm even struggling to get them to sync to my ipho

  • How do i back up my imovies on an external hard disk?

    Hello i am trying  to back up my imovies on a external hard disk , i follow the instructions but everything is still in my computer!! and now when i open updates project ,they are empty!....

  • How can I merge two documents in Pages 5.2?

    I am created a lab manual for my classes and each individual lab is a separate pages file.  It is now time to merge the documents so that the page numbering updates itself and print to PDF to be published.  How do I do that?  I've read online that pa

  • Possible entries restrictions problem..

    Hello~ I have a problem with 'F4'.(ECC6) When I  use F4 on fields and then clicks arrow to show restrictions criteria, I can't input on any fields. They seem to be enabled, but does'nt work. But after clicking show/hide arrow twice(first hide, then s

  • Email functionality for PO Release Strategy:

    Email functionality for PO Release Strategy: >When PO is blocked an email must be sent out to the first approver. >If there is a second approver there should be sent out an e-mail after the first level is approved and soon. >When a PO is released by