Brant:
I suggested four ways to do it and, with your latest memo I advise method
four is the easiest to follow..
When you select a record in one form then it becomes the active record. I
think you probably have a datasheet view of one table and you want to select
a record there (on the datasheet) to add to the other table. You do this by
selecting the record you want to transfer then click a button to add to
table#2. Clicking the button transfers the values one at a time into the
appropriate fields on Form#2 for Table#2.
Assume you have twenty fields in Table#1 and 3 fields in Table#2
Form1 for table#1 and SubForm2 for Table#2
Table#1 has ....First_Name, Second_Name, StudentID, ... etc
Table#2 has only First_Name, Second_Name, StudentID.
The new Button is on Form#1 as MyButton
SubForm2 is <Data Entry> only. (Properties, Form, Data, Data Entry = Yes)
The highligthed record is on Form1 (Table#1 data)
You select the record to transfer then click the MyButton button.
Here is the code
Private Sub MyButton_Click()
forms![form1]![subform2].form![First_Name] = Me.First_Name
forms![form1]![subform2].form![Last_Name] = Me.Last_Name
forms![form1]![subform2].form![StudentID] = Me.StudentID
DoCmd.RunCommand Accommand.SaveRecord
' At this point the record will save and a new blank record will appear on
SubForm2
End sub
Next, select the next record to transfer, and click MyButton etc. This
process allows you to copy one record at a time from one table to the other.
As noted Earlier, SubForm2 does not have to be visible.
Hope this helps,
jim at andersonsoftware dot ca
Brant said:
tynerr said:
Use DAO or ADO to add the record to the second table not an append query.
Alternately you can have a subform bound to the second table on your form
showing a new blank entry It doesn't have to be visible. Copy the values you
want to transfer into variables then have an action button <on click> set the
values on form#2 equal to the values you saved in the variables. Or you can
transfer the values directly as follows.
forms![form1]![subform2].form![Name] = Me.Name
If I wanted to add More than 1 name into the subform, ie create more
records in the subtable how would i go about doing that. Say in a
certain form, i wanted to automatically enter Bob and Alice.
thanks