473,666 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SubForm Problem

DD
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
Nov 12 '05 #1
3 2978
-----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/AwUBP7n7OIechKq OuFEgEQIIjwCdHs FTMN2JCRdOfTzP5 nQRR5PX8gEAoJjI
OfgcHQoCOJoAe4I BtXXHX9Fs
=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

Nov 12 '05 #2
DD
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(ch ild) frmBuilder(Pare nt)

Const frmWorkSheet = "frmBuilder "

DoCmd.OpenForm "frmWorkShe et", , , Forms![frmWorkSheet] =
"SitesID=" & Me!BuilderID, acWindowNormal

WHERE AM I WRONG

MGFoster <me@privacy.com > wrote in message news:<%W******* **********@news read2.news.pas. earthlink.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/AwUBP7n7OIechKq OuFEgEQIIjwCdHs FTMN2JCRdOfTzP5 nQRR5PX8gEAoJjI
OfgcHQoCOJoAe4I BtXXHX9Fs
=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

Nov 12 '05 #3
-----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!frmBuilde r!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 = "frmWorkShe et"
========

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_CHIL D).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/AwUBP7sFyIechKq OuFEgEQLzEQCfeF bgfr2BKZn0KOpEg PkearkvKggAnjFH
tnl29Md+KAiWww3 wGMFzjtHN
=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(ch ild) frmBuilder(Pare nt)

Const frmWorkSheet = "frmBuilder "

DoCmd.OpenForm "frmWorkShe et", , , Forms![frmWorkSheet] =
"SitesID=" & Me!BuilderID, acWindowNormal

WHERE AM I WRONG

MGFoster <me@privacy.com > wrote in message news:<%W******* **********@news read2.news.pas. earthlink.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:::mg f
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7n7OIechKq OuFEgEQIIjwCdHs FTMN2JCRdOfTzP5 nQRR5PX8gEAoJjI
OfgcHQoCOJoAe 4IBtXXHX9Fs
=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

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
680
by: sixsoccer | last post by:
I have built a database with a <Mainform> and a <Subform>. My problem is twofold. 1. My subform is set as a continuos form with AllowAddiotions set to NO (ie. a list of Issues to the client on the mainform) 2. To add new issues, a button is used and a pop-up form is used to add an issue with more detail than what's available on the subform. 3. On accepting the new Issue from the pop-up the pop-up closes and you are returned to the...
25
10221
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
5
3366
by: Bob | last post by:
Hi Everybody I have a form called frmListBox that is connected to a table tblListBox. This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder" and floats above (ie is pop-up) ! Private Sub ListBox_DblClick(Cancel As Integer) DoCmd.OpenForm "Forms!!!.Form! = Me!ListBox.Column(1) Forms!!.Form! = Me!ListBox.Column(2)
1
2501
by: Traci | last post by:
My problem is in a form/subform. On the main form I have an unbound listbox named OptionsInPlan. In the OnCurrent event of the main form I set the value of the listbox with the code: Me!OptionsInPlan.Value = Me!OptionsInPlan.ItemData(0) For some records there are no rows in the listbox. I want to have the subform track the value of the listbox so I set the LinkMaster property to OptionsInPlan and the LinkChild property to ElevationID....
3
4497
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode tblPurchases, with PurchaseId, CustomerId and ProductId I created a form with a subform which shows all the customers, one at a time
4
7002
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
6
3937
by: Sally | last post by:
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried coding the Enter event of the subform control but when I try to scroll the records the code runs. The subform is continuous; all the controls are on one line and the detail section is not exsposed above or below the controls. I tried coding the detail Click event but nothing happened. I tried...
5
1517
by: DS | last post by:
I have a form with 2 Subforms...The first subform is linked to the main form. The second Subform is liked to the first subform. Whenever I add a record to the first subform that works fine. When I add a record to the second subform that also works fine. The problem is the second subform always shows all of the records that are in it. Whenever I scroll through the records in the first subform, the records in the second subform should...
9
9684
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
11
7151
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my mind I am wonder if this is causing my problem, but I don’t want to go through the work to convert to DAO unless I know it is truly in my best interest.) I am having problems getting a requery to show up consistently on a couple of forms. I have...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.