Results 1 to 4 of 4
  1. #1
    vCallNSPF is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    49

    import the foreign key into the primary key

    I have two tables, one for equipment information, (EquipmentInformation) one for tests on the equipment, (EquipmentTest)

    the equipment in formation table has a foreign key, (EquipmentID), which is the primary key in the equipment tests table. this allows me to assign test data to each piece of equipment.



    the EquipmentInformation form is linked to the EquipmentTest form via a command button.

    is it possible, after filling out or viewing the information on a piece of equipment in the EquipmentInformation form, to then press the command button to open the EquipmentTest form AND import the EquipmentID value from EquipmentInformation into the EquipmentID field in the EquipmentTest form.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The answer is probably YES but it sounds like you might have things backwards. You would normally place a PrimaryKey (PK) in another table as a ForeignKey (FK) but not take a FK from one table and put it in another table as a PK.

  3. #3
    vCallNSPF is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    49
    my bad, yeah the other way around

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Simply pass the value in the OpenArgs argument of the OpenForm function and catch it in the OnLoad event of the next form and put it in the field you want. If you could use a mainForm/SubForm arrangement then Access would do it for you if it were the LinkChild/MasterFields value of the SubFormControl.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to query using a foreign-keyed name
    By david28 in forum Queries
    Replies: 0
    Last Post: 10-17-2009, 12:57 PM
  2. Replies: 1
    Last Post: 09-29-2009, 04:34 AM
  3. Getting a foreign key set
    By bkelly in forum Access
    Replies: 5
    Last Post: 08-18-2009, 09:22 PM
  4. Primary/foreign keys + relationships
    By tripptofer in forum Database Design
    Replies: 0
    Last Post: 08-12-2009, 07:44 AM
  5. Foreign Data
    By bmiller in forum Queries
    Replies: 0
    Last Post: 03-21-2006, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums