Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spinning through records on a subform

Status
Not open for further replies.

bitsinc

Programmer
Jun 19, 2002
9
0
0
US
I need to open a second copy of a given form/subform combination for an order entry application. I then need to spin through the detail records on instance 1 of the form/subform, while adding these records on instance 2 of the form/subform combination. I'm adding the parent record for main form fine, it's the detail rows for the subform where I'm having trouble. The problem I'm having is when I try to advance to the second detail row, I instead advance the parent record. I can't seem to reference the detail correctly to advance to the second child record(either to read or to add). Can anyone provide some canned/standard code for bouncing between two form instances to properly do this?
 
I have problems understanding what you mean.
The point is, when you have a mainform that shows records and you dragged a subform into it, where the relation between the two tables is predefined, you would need no code at all to do what you subscribe.

Tell me were I go wrong in understanding.
Success
Hans
 
Ok, I have a form, say ParentForm with a subform Childform. I have the 1 to M relationship defined for the underlying tables (ParentData and ChildData). What I need to do is take a given record on ParentForm and its associated records on ChildForm and create another ParentForm record (mostly the same data but a different primary key) and copy some of the child records also (with needed primary key changes). The Parent row copies fine. However, I also need to select certain rows of the associated ChildForm data and add these as rows as ChildForm rows linked to the added ParentForm record. The way I'm trying to do this is I made a copy of form ParentForm and called it ParentForm2 - which has the same detail form - ChildForm. After a given event, both ParentForm and ParentForm2 are opened. As I said, I can copy the parent row fine. However, when I try to copy child data from ParentForm.ChildForm to ParentForm2.ChildForm I run into problems. Specifically, I can't reference the second child record on ParentForm.ChildForm. Is this more clear? Is there a better way of doing this than trying to open two (nearly identical) forms and trying to copy from one to the other?
 
Understand better now what you want.
I suppose you mean with copying not physical copying, just show the same record twice.
you might add a checkbox-field in the childrecords that you check, depending on 'need-to-be-copied' and have the query in the second childform to show data based on being checked.

Basically there would not be a problem in having a second form with the same subform I think.
I have it a little different though, where I open a COPY of the parentform with all its subforms:


Private frmParentCopy As Form_frmParent

Set frmParentCopy = New Form_frmKandidaat
frmParentCopy.RecordSource = "select * from tblParent"
frmParentCopy.ServerFilter = "..key..=" & Val(formfield)
frmParentCopy.Refresh


In this way you do'nt even have to make (and maintain!) a second form.

Success
Hans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top