Loop - From one Continuous Subform to another

jamesdpmullan

Registered User.
Local time
Today, 18:12
Joined
Oct 21, 2013
Messages
24
OK, i thought i had finally understood loops but this seems to be my downfall!

Before i ask my question, i am where i am as this is the only way i can go about getting the data...I have attached an image of what i am trying to achieve so here goes:

I need to add data from one subform to another - problem is they are both continuous forms and both subforms.

The part in green is where it needs to go, and the white is where the data is held. The links have already been created, i just need to get the info from subform 1 to subform 2.

I have attached code but it only moves line selected / first line.

Any help appreciated

Code:
Dim dst As DAO.Recordset

        Set dst = Me.frmAS9102_Material_LINK.Form.RecordsetClone

     With dst
     
     .MoveFirst
            Do While Not .EOF
            Form2MatFAIBatchNumber = Forms!frmas9102releasesheet!frmAS9102Form2Material.Form!frmAS9102_Material_LINK.Form!works_order_number
            MaterialProcess = Forms!frmas9102releasesheet!frmAS9102Form2Material.Form!frmAS9102_Material_LINK.Form!stock_reference
            SpecialProcess = Forms!frmas9102releasesheet!frmAS9102Form2Material.Form!frmAS9102_Material_LINK.Form!material_type
            dst.MoveNext
        Loop
        End With

Set dst = Nothing
 
Last edited:
the correct way would be to insert the record as normal using subform1.

then simply requery sdubform2. This should pick up the new data, and display it.

the keyword from is needed in this expression.

forms!formname!subformcontrolname.form.requery
 
Hi

Thanks for your reply. I may not have explained myself correctly.

I have added this subform (subform 1 - white boxes) which contains around 2 million records.

What i am trying to do in affect is run an append query without the query, hence the loop.

all im trying to do is move the data from subform 1 to subform 2 using the loop.

Sub form 1 which holds all the data is master/child linked with the main form.
Sub form 2 is also master/child linked to the main form but i need to get the data from subform 1 to subform 2.

...Unless im reading your post incorrectly for which i apologies!
 
Sub form 1 which holds all the data is master/child linked with the main form.
Sub form 2 is also master/child linked to the main form but i need to get the data from subform 1 to subform 2.
Why on earth are you doing this? This is so over complicated !
 
Hi

Thanks for your reply. I may not have explained myself correctly.

I have added this subform (subform 1 - white boxes) which contains around 2 million records.

What i am trying to do in affect is run an append query without the query, hence the loop.

all im trying to do is move the data from subform 1 to subform 2 using the loop.

Sub form 1 which holds all the data is master/child linked with the main form.
Sub form 2 is also master/child linked to the main form but i need to get the data from subform 1 to subform 2.

...Unless im reading your post incorrectly for which i apologies!

besides what paul just said - what I am saying is think about this from the point of view of the data. If you need to see data in a given form, then the query that supplies that form needs to return the data.

the easiest way (I hesitate to say the right way) is to let the data drive itself - so that you simply requery the data. Instead of thinking in terms of pushing data from form A to form B, think in terms of getting form A to manage the system's data store, so that other forms have the correct data available, which avoids you having to write loads of special code.
 

Users who are viewing this thread

Back
Top Bottom