Add new records to subform on load

aron.ridgway

Registered User.
Local time
Today, 20:07
Joined
Apr 1, 2014
Messages
148
I have got a received form that has 2 subforms.
The main form is based on Received Table
The 1st subform is based on a query that shows the order detail and how many units are outstanding.
The 2nd subform is based on a receivedDetail table. so will have a list of items with the original order qty, and the qty still outstanding.

When the main form loads i want it to create new records into the 2nd subform based on the 1st Subform.

so the 1st and 2nd subform run parallel with each other and appear to be as one to the user.

both subforms are continuous style.

ive tried the following code but with no joy.

Code:
Private Sub Form_Load()

With Me.Form.RecordsetClone
Do While Not .EOF
.AddNew
!UserFK = Forms!frmReceive!cbxUsername
!ReceiveFK = Forms!frmReceive!txtRecievePK
!OrderDetailFK = Forms!frmReceive!txtRecieveOrderFK
.Update
.MoveNext
Loop
End With
Me.Requery
End Sub
 
Your requirement sounds a lot more bizarre. Can you explain in simple terms what the system you are dealing with and why this odd addition? So if the Form is loaded 75 times in an hour, you would need 75 records :eek:
 
The form is used to populate the Receive table and ReceiveDetail Table.
So when ever the form is opened it is to receive an item line. therefore it will create 1 Receive PK and if there are 15 items for that order, it will create 15 Receive detail PK.

The aim is to automate all of Receive Detail info apart from the Qty which the user will fill in.

So it needs to loop through x times based on how many lines there are for the order?

hopefully this makes it a bit clearer?
 

Users who are viewing this thread

Back
Top Bottom