Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    1

    Unanswered: relationship problem

    I am using 2 tables with the structure.

    Table1
    user_id
    date
    timein
    timeout

    Table2
    user_id
    date
    Activities
    duration

    This is Timesheet Entry Application. In Table1 combination of (user_id+date) makes primary key. There is 1 to many relationship between Table1 & Table2 with Enforce Referential Integrity option using above Primary key. I have one main form(using Table1) and related subform(using Table2), subform is related with main form using user_id & date. Problem is this whenever i enter user-id and date from main form and related activities in subform it works good for that day but next day for the same user_id when i enter new date it always display all the previous day activities also for that user.I want whenever i enter useer_id with a new date it should display a new blank record both in main and subform. Help me, how i can do that..
    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Romania - Bucharest
    Posts
    50
    Try create an Autonumber field in Table1 (let's call it tbl1id), create an "longInt" field in table 2 (lets call it also tbl1id), set in Table1 the tblid field as the primary key and set the 1-M relationship to field tbl1id in table 2.

  3. #3
    Join Date
    Mar 2004
    Posts
    118
    You cant link a primary key to another primary key....

    If you have 2 separate tables both dependant on a primary key called user_id it defeats the whole point of having 2 tables.

    What I suggest you do is have 1 main table:

    User_id
    activity_id
    date
    field1
    field2
    field3

    And 1 dependant table

    Activity_id
    date
    field1
    field2

    Where Activity_id in the main table is the foreign key.

    If you have attributes that are directly dependant on user_id they should be moved to the main table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •