Carry over fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am trying to setup a series of forms so that I enter data into the first form, then hit an open form button it opens a new form (for more dataentry) and carries over the value that ties to the two forms together. Each of the forms is tied to a separate table. The second table has a value that has a relationship back to the first table. I have been using the wizard for cmd buttons, and defining the matching fields in the wizard. Obviously, I need someway to get the new record on the second (and third etc) forms to have the control record of the top level record.

I set up a db to do this years ago and I seem to have forgotten how. BTW, this is access 2003.

Thanks
 
Scott,

Since you indicate that the 2nd and 3rd forms are based on
separate tables, what you need to do is make sure that the
primary key values from your first table get written to
the 2nd and 3rd tables.

In the click event of your command button, you need to add
some code that will insert the values from the current
record to the new tables, then open the new form to that
record.

Something like the following. This is untested air-code.
I am sure that the number of commas in the Openform method
is not correct, but you need to put the criteria in the
WHERE portion of that method.

Private Function cmd_NextForm_Click()

Dim strSQL as string
strSQL = "INSERT INTO Table2 (ID) " _
& "SELECT " & me.txt_ID
currentdb.execute strsql

docmd.openform "frm_2ndForm",,,"ID = " & me.txt_ID
End Function

HTH
Dale
-----Original Message-----
Hi,

I am trying to setup a series of forms so that I enter
data into the first form, then hit an open form button it
opens a new form (for more dataentry) and carries over the
value that ties to the two forms together. Each of the
forms is tied to a separate table. The second table has a
value that has a relationship back to the first table. I
have been using the wizard for cmd buttons, and defining
the matching fields in the wizard. Obviously, I need
someway to get the new record on the second (and third
etc) forms to have the control record of the top level
record.
I set up a db to do this years ago and I seem to have
forgotten how. BTW, this is access 2003.
 
Back
Top