How to transfer 2 values from form A to form B when form B is an extension of A?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Heidi Venegas

    How to transfer 2 values from form A to form B when form B is an extension of A?

    I have created a database for a dental research study, which requires 5 different standardized forms (data gathering forms). One of this forms requires more than 300 fields, and hence, did not fit altogether in just one table. I created two tables and two forms in order to gather all the data. These two tables have a compound primary key because the combination of ID and Visit Number make the entry unique. I have included a control in Form A to open Form B, and is working accordingly. Now, I want to make the data entry process as seemless as possible, therefore, I want to click to open form B and have the ID and Visit number automatically populated, so that the data entry personnel only has to worry about completing the form and saving the record as soon as they finish form B.

    I don't have extended knowledge on code, yet I have managed so far to make this thing work. I really need detailed explanation and steps to make this happen. Pleaseeeee!!! Thanks! By the way, Id is integer and visit number is lookup combobox.
  • gnawoncents
    New Member
    • May 2010
    • 214

    #2
    If ID and Visit Number need to be in two separate fields on the new form, you could try something like this:

    In the on open event of Form B, include the following code:

    Code:
        DoCmd.GoToRecord , , acNewRec
        Me.[ID] = Forms!FormA![ID]
        Me.[Visit Number] = Forms!FormA![Visit Number]
    Depending on your setup, you may need to modify this approach.

    Comment

    Working...