arkres
09-26-2001, 12:23 PM
Hello. I have a form in my database with a command button that opens another form (based on a related table) at a new record. I would like two pieces of data from the record displayed on the original form to be automatically filled in on the newly opened form. Can anyone help? I'd really appreciate it.
lscheer
09-26-2001, 01:00 PM
You might check out my post from yesterday: http://www.access-programmers.co.uk/ubb/Forum6/HTML/000281.html
The part that works for me should work for you, though it uses a macro, you should be able to just do the open form/gotocontrol/setvalue actions to where your ID fields match each other. I'm sure there's a better way to do this, but I never got much input when I was trying to figure it out.
HTH
Travis
09-26-2001, 02:33 PM
After you open the form then just do this
Private CommandButtonToOpenForm_Click()
'...Your code to open the form
'Now set the variables
Forms![TheSecondFormName].[TheFirstDataFieldName] = Me.[TheFirstDataFieldName]
Forms![TheSecondFormName].[TheSecondDataFieldName] = Me.[TheSecondDataFieldName]
End Sub