473,750 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SubForm Reference Syntax Problem

My popup form can reference the MAINFORM by using either line of the
code shown below:

--------------------------------------------------------------------------------
[Forms]("F-PERS").Controls ("cboEduc").Req uery

'My reference using hidden text boxes.
[Forms](txtFormName).C ontrols(txtComb oName).Requery
--------------------------------------------------------------------------------

My problem is that my popup form cannot seem to reference my SUBFORM
that is located in a tab of my main form. My subform control is called
F-CREDsub and its source is the form F-CRED.

How would the content of my hidden textbox txtFormName look???
I tried "F-CREDsub" "F-PERS.F-CREDsub" but it does not work?

Thanks
Greg

Feb 13 '07 #1
5 2621
The subform is not open in its own right. It is not part of the Forms
collection, so (as you found) you cannot refer to it directly that way.

You may be able to pass a reference to the combo that needs requerying
instead of trying to give the whole reference. For example, you might add
this to the General Declarations of a standard module:
Dim cbo2Requery As ComboBox

Then before you call your popup:
Set cbo2Requery = Me(txtComboName )

Then in the AfterUpdate event of the popup:
If Not cbo2Requery Is Nothing Then
cbo2Requery.Req uery
End If
Set cbo2Requery = Nothing

For general info on how to refer to a control on a subform through the Forms
collection, see:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<Ap******@gmail .comwrote in message
news:11******** *************@p 10g2000cwp.goog legroups.com...
My popup form can reference the MAINFORM by using either line of the
code shown below:

--------------------------------------------------------------------------------
[Forms]("F-PERS").Controls ("cboEduc").Req uery

'My reference using hidden text boxes.
[Forms](txtFormName).C ontrols(txtComb oName).Requery
--------------------------------------------------------------------------------

My problem is that my popup form cannot seem to reference my SUBFORM
that is located in a tab of my main form. My subform control is called
F-CREDsub and its source is the form F-CRED.

How would the content of my hidden textbox txtFormName look???
I tried "F-CREDsub" "F-PERS.F-CREDsub" but it does not work?

Thanks
Greg
Feb 13 '07 #2
Allen, is that to say that a popup form cannot reference the subform
that originally called it? Then how do you guys refresh a combobox
after its table contents change, having used the popup form method? Is
there another approach?
If its the one you suggested, I really dont understand it, and a
weblink might be helpful. I checked out the Link to "Referring to
Controls on a Subform", and still think my problem somehow has
something to do with syntax?

Thanks As Always

Greg

Feb 13 '07 #3
On Feb 12, 9:11 pm, "ApexD...@gmail .com" <ApexD...@gmail .comwrote:
Allen, is that to say that a popup form cannot reference the subform
that originally called it? Then how do you guys refresh a combobox
after its table contents change, having used the popup form method? Is
there another approach?
If its the one you suggested, I really dont understand it, and a
weblink might be helpful. I checked out the Link to "Referring to
Controls on a Subform", and still think my problem somehow has
something to do with syntax?

Thanks As Always

Greg


Usually when I need to access controls on a sub form, I drill down
like this MainForm.SubFor mControl.Form.T argetControl.Pr opertyorMethod
I've not done it through a tab control in a long time so I'm not sure
if you need to pass through the Tabs collection or not.
Feb 13 '07 #4
Your example was:
[Forms](txtFormName).C ontrols(txtComb oName).Requery

That cannot work if txtFormName contains the name of a subform control,
since subforms are not part of the Forms collection. Loop through the forms
and verify for yourself that the subforms are not there:
Dim i As Long
For i = 0 to Forms.Count -1
Debug.Print Forms(i).Name
Next

If you just want to requery a single combo, the public object variable will
do it.

To answer your question, what I actually do is to call a public function
named NotifyCombos() in the AfterUpdtate and AfterDelConfirm of all forms.
The function is completed after the database is built, and it consists of a
massive Select Case statement that handles all the dependencies so that any
open forms are notified of the change.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<Ap******@gmail .comwrote in message
news:11******** ************@v3 3g2000cwv.googl egroups.com...
Allen, is that to say that a popup form cannot reference the subform
that originally called it? Then how do you guys refresh a combobox
after its table contents change, having used the popup form method? Is
there another approach?
If its the one you suggested, I really dont understand it, and a
weblink might be helpful. I checked out the Link to "Referring to
Controls on a Subform", and still think my problem somehow has
something to do with syntax?

Thanks As Always

Greg
Feb 13 '07 #5
This finally resolved my problem:

Forms("[F-PERS]").Controls ("[F-CREDsub]").Form.cboEduc .Requery

ThankYou All
Greg

Feb 14 '07 #6

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

Similar topics

15
24867
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that contains the subform is named Clients. I have this code in the Add Client btn: If Forms!Clients.subformVisits!VisitDirty = True Then MsgBox "Visit subform is dirty!"
25
10257
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...
1
8510
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a subform of the subform. the main Form is called Subform is called Subform in the subform is called
5
3654
by: ego | last post by:
Hi all , I had created the following Form/SubForm structure : MainForm SubForm A (SubForm of MainForm) SubForm B (SubForm of SubForm A) SubForm C (SubForm of SubForm B) SubForm D (SubForm of SubForm C)
3
1840
by: Kranman | last post by:
Hi All, Love this site, have gotten a lot from it. This is my first time posting though, so forgive me for any errors. I have an Access 2000 db where I have a main form of Contractors and on the main form is a subform of bonds carried by those contractors. I am trying to reference a field named "Bond" located on the subform in code that is run from the mainform and am having trouble with the syntax for this. Below is a sample of...
3
5344
by: Mike Jakes | last post by:
I hope that someone can offer a little advice on this one - I've searched the group but can't find an answer. I think that I'm doing something really stupid or missing something trivial, but see what you can make of this... I have a main form "Events" that contains a tab control. The tab control has 7 pages. The 7th page (named "Boats") contains a subform called "BoatEventssubform". On this sub-form are two combo boxes, named...
8
8327
by: Robert | last post by:
I have a form (Worksheet) that works fine by itself. I have now created a seperate form (MainForm) that has a command button in the header and an unbound subform (FormFrame) in the Detail section. when the user clicks the command button, Worksheet is loaded into the subform control. At this point, some of the functions do not work. The user is prompted to enter a Parameter Value. Why wouldn't that form (Worksheet) work the same as a sub...
14
18047
by: mchlle | last post by:
How can I filter records of a subform that is part of a tab control? The filter works fine on the form when it is not part of the tab using this in the macro condition: !!="Today" I have a main form with a tab control which has three tabs and on each tab there is a subform. Main Form: frmEmploymentVerification Tab Control Name: TabEmployment
14
3316
by: (PeteCresswell) | last post by:
I've got a form (frmDeal) that has a subform (frmDeal_Tranche) that has a subform (frmDeal_TrancheCusip). When I try to refer to properties on the "Cusip" form at the end of the chain, MS Access is throwing "2455: Expression has invalid reference to Property Form/Report" In an Immediate window: ------------------------------------------
0
9000
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9396
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
9339
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
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6804
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
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
4713
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2225
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.