Passing values from one form to a new record in another form

duthiedon

Donner
Local time
Today, 05:10
Joined
Dec 27, 2007
Messages
60
Have one form that contains values AssociatedProject and AssociatedRelease that need to be passed onto another form that opens with a new record. Have tried different variations based on what I read here and couldn't get them to work. Here's what I have at the moment and any help would be gratefully appreciated.

Initial form - frm_ViewList contains the values that I need to pass on and has a "Add" button to bring up the new form that also creates a new record. The add button contains the following:

Dim stDocName As String

MyAssociatedProject = Me.AssociatedProject
MyAssociatedRelease = Me.AssociatedRelease

stDocName = "Frm:ManageQuestionsAnswersProc"
DoCmd.OpenForm stDocName, acNormal

DoCmd.GoToRecord , , acNewRec

Then in the second form Frm:ManageQuestionsAnswersProc the following code is contained in the Before Insert:

Me.AssociatedProject = MyAssociatedProject
Me.AssociatedRelease = MyAssociatedRelease

Thanks...
 
Thank you very much this was very helpful! Had a few additional things to tweak, since I'm add a new record, but it works beautifully!
 
I'm sure you found that the OpenForm command has an acFormAdd argument. Glad we could help.
 

Users who are viewing this thread

Back
Top Bottom