Appending records from form and it's subform

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

Guest

I have a form that has a subform (frmOptions with sfrmParts). I need to
append both the frmOptions and the multiple Parts that go with it. My code is
weak and I am going crazy. I would apprecitate any help anyone can give me.
Terri
 
well, you can't append a *form* to anything. are your form and subform bound
to tables? if so, when you enter data it will be saved into the tables
automatically. do you want to append it to other tables? if so, where and
why? also, it would help to have specific information about what you've
tried, and what resulted - error messages, etc.

hth
 
Yes, they are based on query's that are based on tables. The appends must be
into the same tables.

It is a case of 2nd option with most the same data (which is a lot) and in
the same db, the same job based on a previous job but one or two facts need
to be changed. There are 6 fields in the tblOptions but 46 in the tblParts.
 
okay, if the forms are bound to queries, and if you want the data stored in
the tables that the queries are based on, then - as i said before - you
don't have to append anything. any data you enter in bound controls on the
form with *automatically* be written to the tables in the underlying query.
well, i should say - as long as the queries are updateable. are they?

hth
 
You are not understanding what I am looking for. My db user (a printer) has a
client who has asked for 2 different prices for a job. Option 1 is includes
part 1 for 500 cards and part 2 for 500 envelopes. They have put in the 4
pieces of information that the option needs and the 46 pieces of info that
each of the parts needs to get the client the price. But the client wants to
also know how much 1000 of each part would be. Only 5 or 6 fields need to be
changed. The user doesn't want to retype close to 100 pieces of info, so I
need to create a way to duplicate the Option and then duplicate the parts
from Opton 1 to attach to the new option. I can get the option to append but
not the parts to append to the new option.
 
okay. you'd basically need to do the following:

1. save the primary key value of the current option record to an unbound
textbox control on the form (the control can be invisible), i'll call txtPK.
2. append the "new" option record to the table, requery the form's
RecordSource, and navigate to the new record.
3. run an Append query on the parts table, with criteria set on the option
foreign key field, that refers back to the unbound textbox control on the
form, as

[Forms]![FormName]![txtPK]

make sure you append the primary key value of the *current* form record (the
"new" option record) into the option foreign key field in the parts table -
don't use the value in [xtPK]. then requery the subform's RecordSource.

hth
 
Back
Top