-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You are using the Constant incorrectly. Do not put quotes around the
name of the Constant. You do not need to include the name of the
child form in the WhereCondition parameter. You do not need to
explicitly set the WindowMode parameter to acWindowNormal because that
is the default setting.
==
Since you want the child form snyched with the parent form you will
have to have the child form's RecordSource something like this (should
be one line):
SELECT * FROM <table/query name> WHERE SitesID =
Forms!frmBuilder!SitesID
Put in the table/query name the child form uses.
There must be a control on the parent form named SitesID.
==
Put the child form Constant declaration in the Declarations section of
the parent form's module.
Const FORM_CHILD = "frmWorkSheet"
========
Private Sub cmdChild_Click()
DoCmd.OpenForm FORM_CHILD
End Sub
When the parent form moves to another record/closes the child form
must be "notified." This can be accomplished by putting the
appropriate code in the parent form's OnCurrent and OnClose events.
== air code ==
Private Sub Form_Current()
On Error Resume Next
Forms(FORM_CHILD).Requery
End Sub
Private Sub Form_Close()
On Error Resume Next
DoCmd.Close acForm, FORM_CHILD
End Sub
HTH,
MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBP7sFyIechKqOuFEgEQLzEQCfeFbgfr2BKZn0KOpEgPkear kvKggAnjFH
tnl29Md+KAiWww3wGMFzjtHN
=ywEB
-----END PGP SIGNATURE-----
DD wrote:
I am still not getting it right.
MY ORIGINAL QUESTION
I want to link a form to another form by a Cmd Button.
CustomerID = CustomerID
I want the form to open from the Cmd Button as if it was acting in the
same way as subform
What would be the code? as Access dose not show you.
DD
The form Opens ok but is not displaying that it is linked to the
BuilderID
(OPENS A FORM WITH NO LINK)
Here is what i have written in the CmdOpen Click
frmWorkSheet(child) frmBuilder(Parent)
Const frmWorkSheet = "frmBuilder"
DoCmd.OpenForm "frmWorkSheet", , , Forms![frmWorkSheet] =
"SitesID=" & Me!BuilderID, acWindowNormal
WHERE AM I WRONG
MGFoster <me@privacy.com> wrote in message news:<%W*****************@newsread2.news.pas.earth link.net>...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Actually, there are examples in the Help files (if you can find them).
Anyway...
Private Sub cmdOpen_Click()
Const FORM_SUB = "frmMyOtherForm"
DoCmd.OpenForm FORM_SUB, _
WhereCondition:="CustomerID=" & Me!CustomerID
End Sub
Change the FORM_SUB constant to the name of the form you want to open.
You'll need a control named "CustomerID" on the main form (it can
have property Visible=False). This control should have a value before
the "Open" CommandButton is clicked.
See the Help files on the "OpenForm method."
HTH,
MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBP7n7OIechKqOuFEgEQIIjwCdHsFTMN2JCRdOfTzP5nQRR5 PX8gEAoJjI
OfgcHQoCOJoAe4IBtXXHX9Fs
=EqQB
-----END PGP SIGNATURE-----
DD wrote:
I want to link a form to another form by a Cmd Button.
CustomerID = CustomerID
I want the form to open from the Cmd Button as if it was acting in the
same way as subform
What would be the code? as Access dose not show you.
DD