Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

linked forms

Discussion in 'Information Technology' started by Bob, Jul 28, 2006.

Tags:
  1. Bob

    Bob
    Expand Collapse
    Guest

    I have one form that inputs information into a table. I have a button on
    that form that opens another form that I want to populate another table
    linked by a field from the first table. The form works ok if I manually
    populate the linked field, but I thought there is a way to open the child
    form with the forms already linked.

    example
    form1

    employeeID
    strlastname
    strfirstname

    form2
    employeeID
    intProjectnum
    dtDateStart
    dtDateFinish

    I want form 2 open with the employee field already populated with the
    employee ID. I did the wizard and selected the option to show only specific
    records. I have even tried to save the record from form 1 first - still no
    luck. What am I doing wrong?
     
  2. Loading...

    Similar Threads Forum Date
    Opinion Letter: When terrorism is falsely linked by race or religion, we all become the victims Breaking News Apr 27, 2013
    SciTech Law of Entropy Linked to Evolution of Intelligence Breaking News Apr 23, 2013
    Canada GM corn linked to early death in new study Breaking News Sep 22, 2012
    India set to ban 100 Al Qaeda-linked groups Hard Talk May 17, 2010
    Sikh News Temple linked to terrorists still active (Moldova.org) Breaking News Feb 5, 2008

  3. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    use the Openargs & set the default value of the field (for new records)
    or use the wherecondition of the docmd.openform

    hth

    Pieter

    "Bob" <poopsie@comcast.com> wrote in message
    news:iNscg.3388$rS6.1225@fed1read11...
    >I have one form that inputs information into a table. I have a button on
    >that form that opens another form that I want to populate another table
    >linked by a field from the first table. The form works ok if I manually
    >populate the linked field, but I thought there is a way to open the child
    >form with the forms already linked.
    >
    > example
    > form1
    >
    > employeeID
    > strlastname
    > strfirstname
    >
    > form2
    > employeeID
    > intProjectnum
    > dtDateStart
    > dtDateFinish
    >
    > I want form 2 open with the employee field already populated with the
    > employee ID. I did the wizard and selected the option to show only
    > specific records. I have even tried to save the record from form 1
    > first - still no luck. What am I doing wrong?
    >
    >
    >
     
  4. Pat Hartman\(MVP\)

    Pat Hartman\(MVP\)
    Expand Collapse
    Guest

    Use the OpenArgs argument of the OpenForm Method to pass the primary key
    value to the popup form. Then in the BeforeInsert event of the popup form,
    you need only a single line of code:

    Me.ForeignKeyName = Me.OpenArgs

    I prefer to use the BeforeInsert event because that prevents my code from
    dirtying the record. The BeforeInsert event fires after the first character
    is typed in a new record so at that point, the user has dirtied the record
    and it is OK for my code to run.

    "Bob" <poopsie@comcast.com> wrote in message
    news:iNscg.3388$rS6.1225@fed1read11...
    >I have one form that inputs information into a table. I have a button on
    >that form that opens another form that I want to populate another table
    >linked by a field from the first table. The form works ok if I manually
    >populate the linked field, but I thought there is a way to open the child
    >form with the forms already linked.
    >
    > example
    > form1
    >
    > employeeID
    > strlastname
    > strfirstname
    >
    > form2
    > employeeID
    > intProjectnum
    > dtDateStart
    > dtDateFinish
    >
    > I want form 2 open with the employee field already populated with the
    > employee ID. I did the wizard and selected the option to show only
    > specific records. I have even tried to save the record from form 1
    > first - still no luck. What am I doing wrong?
    >
    >
    >
     

Share This Page