View Full Version : Copy Value to subform


c00ps
10-22-2000, 04:14 PM
I am fairly new to Access and have to develop a DB for Uni.
I have a form that has a number of details entered relating to an aircraft flight (ie Sydnet to London). I then open a sub-form to enter details relating to the flight sectors ( ie Syney to Hong-Kong. Hong-Kong to London). When I open the sub-form I would like to automatically fill the flightNo textbox with the value that has been entered in the previous form.
Can someone please suggest a simple way to do this?
Thanks

yeatmanj
10-23-2000, 09:35 AM
I have a few forms set up where i do something similar. I use the following code in the onactivate of the form that i want the values from the previous form to appear in. But the first form has to be open for it to work.

If Me.NewRecord Then
Me.FacID = Forms!frmDocumentMovementMain!FacID
Me.Date_Recieved = Forms!frmDocumentMovementAddEdit!DateIn
Me("Work Order #") = Forms!frmDocumentMovementAddEdit("WorkOrder#")
End If

The Me. statement refers to the form that i want the values to appear in. The Forms! statments refer to the form that i am getting the information from. That should take care of it.

Pat Hartman
10-23-2000, 05:30 PM
If the master/child link fields are set properly for the subform, Access will populate the linking fields. No code is required.