Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    10

    Unanswered: How Do I set Form Field with Value

    Hello,

    I am prototyping something and have a very simple database. I have two tables that are related in a one-to-one relationship by a single key. I have built two queries and I have built two forms. Form1 is tied to Query1 and Form2 is tied to Query2. I have a "Next" button on Form1 which basically closes Form1, opens Form2, and filters Form2 according to Form1.

    On data entry, the primary key is an Autonumber field which is gets automatically generated. I don't want the user to have to manually type in this value on Form2 so before Form2 is opened, I want to set the value of the Primary Key to be the same as the Autonumber key that was generated on Form1 (this is the one-to-one key). In my code, how can I say Form2.MyID = Form1.MyID?

    Thanks,

    Becky

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    put your primary key in to OpenArgs parameter of docmd.openform method. then you can read it in Form2 with Me.OpenArgs property.
    ghozy.

Posting Permissions

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