Passing Data from form1 to form2 using a buttom

  • Thread starter Matthew Mandalek
  • Start date
M

Matthew Mandalek

I have a form containing some fields of data that correspond to other fields
of data on another form. There is a button on form1 that opens a new record
on form2. I want to take some of the data fields on form1 and populate the
corresponding fields on form2 with the values. What is the best way to do
this?

Thanks

Matt
 
R

rick

Matthew said:
*I have a form containing some fields of data that correspond t
other fields
of data on another form. There is a button on form1 that opens a ne
record
on form2. I want to take some of the data fields on form1 an
populate the
corresponding fields on form2 with the values. What is the best wa
to do
this?

Thanks

Matt *

Matt, this is very unclear what you are talking about. Are th
controls bound? You are talking about "fields" on the forms... do yo
have one table or multiple tables? Maybe put the code out o
something. I'm not fully following this (and I read it about 3 times)
 
R

rick

Matthew said:
*I have a form containing some fields of data that correspond t
other fields
of data on another form. There is a button on form1 that opens a ne
record
on form2. I want to take some of the data fields on form1 an
populate the
corresponding fields on form2 with the values. What is the best wa
to do
this?

Thanks

Matt *

Matt, this is very unclear what you are talking about. Are th
controls bound? You are talking about "fields" on the forms... do yo
have one table or multiple tables? Maybe put the code out o
something. I'm not fully following this (and I read it about 3 times)
 
R

Ronald W. Roberts

Matthew said:
I have a form containing some fields of data that correspond to other fields
of data on another form. There is a button on form1 that opens a new record
on form2. I want to take some of the data fields on form1 and populate the
corresponding fields on form2 with the values. What is the best way to do
this?

Thanks

Matt
Lookup OpenArgs property in help.

The following example uses the OpenArgs property to open the Employees
form to a specific employee
record and demonstrates how the OpenForm method sets the OpenArgs
property. You can run this
procedure as appropriate — for example, when the AfterUpdate event
occurs for a custom dialog
box used to enter new information about an employee.

Sub OpenToCallahan()
DoCmd.OpenForm "Employees", acNormal, , , acReadOnly, , "Callahan"
End Sub

Sub Form_Open(Cancel As Integer)
Dim strEmployeeName As String
' If OpenArgs property contains employee name, find corresponding
' employee record and display it on form. For example,
' if the OpenArgs property contains "Callahan", move to first
' "Callahan" record.
strEmployeeName = Forms!Employees.OpenArgs
If Len(strEmployeeName) > 0 Then
DoCmd.GoToControl "LastName"

DoCmd.FindRecord strEmployeeName, , True, , True, , True
End If
End Sub

The next example uses the FindFirst method to locate the employee named
in the OpenArgs property.

Private Sub Form_Open(Cancel As Integer)
If Not IsNull(Me.OpenArgs) Then
Dim strEmployeeName As String
strEmployeeName = Me.OpenArgs
Dim RS As Recordset
Set RS = Me.RecordsetClone
RS.FindFirst "LastName = '" & strEmployeeName & "'"
If Not RS.NoMatch Then
Me.Bookmark = RS.Bookmark
End If
End If
End Sub

Ron
 
M

Matthew Mandalek

All of the fields on the form are bound to record fields in 2 or 3
(depending on which form I am working with) tables. I need for that
information on FORM1 to be copied to the form and table fields of a
completely different form (FORM2 or FORM3) with fields bound to a completely
different tables... such as ...

FORM1: [workorder]
clientname
subject
cost

FORM2: [invoice]
clientname
subject
cost

or even to another form

FORM3: [workorder]
clientname
suject
tech
comments


Hope this helps clear the clouds.

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top