open form&fill in data

arkres

Registered User.
Local time
Today, 23:40
Joined
Sep 26, 2001
Messages
62
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.
 
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
 
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
 

Users who are viewing this thread

Back
Top Bottom