HELP!!

G

Guest

I am desperately trying to figure out a way to establish a link from a field
on a main form (master) to a field on another form (child) like you're able
to do with a main form to a subform.
On the main form, I have a control button that opens another form and I
would like that form to open with the information tied to the field from the
main form.

Is this possible?????
 
J

John Vinson

Most people who post here want help with something. The volunteers who
answer questions are much more likely to be interested in a subject
line like "Linking two forms, not subform" than in a shout for HELP!!.
I am desperately trying to figure out a way to establish a link from a field
on a main form (master) to a field on another form (child) like you're able
to do with a main form to a subform.
On the main form, I have a control button that opens another form and I
would like that form to open with the information tied to the field from the
main form.

Is this possible?????

Yes, by redoing some of the work that the form/subform linkage does
for you (any reason why you CANNOT use a subform? say on a tab page to
save screen space?)

In the OpenForm event you can use the WhereCondition argument to limit
the child form to those records that match the current mainform
record; you can also use the OpenArgs argument to pass the ID value so
that the child form can use it as a default. Air code:

Dim strCrit As String
....
strCrit = "[ID] = " & Me!txtID
DoCmd.OpenForm "frmChild", WhereCondition:=strCrit, _
OpenArgs:=Me!txtID
....

and then in frmChild's Open event:

Private Sub Form_Open(Cancel as Integer)
If Not IsNull(Me.OpenArgs) Then
Me.txtID.DefaultValue = Chr(34) & Me.OpenArgs & Chr(34)
End If
End Sub
 
R

Rick Brandt

I am desperately trying to figure out a way to establish a link from a field
on a main form (master) to a field on another form (child) like you're able
to do with a main form to a subform.
On the main form, I have a control button that opens another form and I
would like that form to open with the information tied to the field from the
main form.

Is this possible?????

You can either...

Push the data to the popup form from the calling form.
DoCmd.OpenForm "FormName"
Forms!FormName!ControlName = Me.ControlName

Pull the data from the popup form in its Open event
Me.ControlName = Forms!CallingFormName!ControlName

Pass the link data as an OpenArgs parameter when opening the popup
DoCmd.OpenForm "FormName",,,,,,"SomeValue"

Then in the popup form's Open event...
Me.ControlName = Me.OpenArgs
 
B

Barry

If you are opening the form with an Open Form macro, you
can type an expression on the Where Condition line. It
could look like this:

[Field Name]=[Forms]![Form to be Opened]![Field name as
on previous field]

Good luck.
 
R

Rebecca Riordan

Set the source of the field on the child form to
Forms!<formName>!<controlName>

HTH

--
Rebecca Riordan, MVP

Designing Relational Database Systems
Microsoft SQL Server 2000 Programming Step by Step
Microsoft ADO.NET Step by Step

http://www.microsoft.com/mspress

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...
 
A

Anandan

You can do it with a macro.
When you open the second form (Let us call it the Form2)
keep the Main form open. (Do not use close form Marro)
Use set value macro action to set the value of the field
in the Form2 as in Mainform
Macro Name SetValueForm2
Action: SetValue
Item: Forms![Form2]![ChieldField]
Expression: Forms![MainForm]![MasterField]
Link this macro to on open property of Form2 or as step 2
in the macro linked to your control button
Good luck
 
D

Damien McBain

I am desperately trying to figure out a way to establish a link from
a field on a main form (master) to a field on another form (child)
like you're able to do with a main form to a subform.
On the main form, I have a control button that opens another form and
I would like that form to open with the information tied to the field
from the main form.

Is this possible?????

You can do it with the Command button wizard then check out the code it
produces.
 

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