473,569 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

set focus to a subform within a subform within a subform

n8kindt
221 New Member
ok, i have a fairly complicated form that goes three forms deep. i've been avoiding this particular dliemma for a while hoping the answer would come to me in a dream or something but i think it's finally time to pose the question. anyone know how to do this? i can set focus to a subform control by using this:
Expand|Select|Wrap|Line Numbers
  1. Me.subform1.Form.txt1.SetFocus
but how do i add another subform (or two) to that code? vba doesn't excactly autofill it in so i'm lost.
Jul 29 '08 #1
16 5306
puppydogbuddy
1,923 Recognized Expert Top Contributor
the reference to second nested subform from the main form is:

Expand|Select|Wrap|Line Numbers
  1. Me!Subform1.Form!Subform2.Form!ControlName
You can obtain the syntax from this link:

http://www.mvps.org/access/forms/frm0031.htm
Jul 30 '08 #2
Delerna
1,134 Recognized Expert Top Contributor
I created a form (frmSubform2) with a text box (Text0) on it
I then created another form (frmSubform1) with a subform (frmSubform2) on it.
I then created a form with a subform (frmSubform1) on it.
In the on load event for the final form I put the following code

Expand|Select|Wrap|Line Numbers
  1. Me!frmSubform1.Form!frmSubform2.Form!Text0 = "Hello"
  2.  
and it worked.
Jul 30 '08 #3
Delerna
1,134 Recognized Expert Top Contributor
Puppydogbuddy posted while I was posting mine.
:)
Jul 30 '08 #4
ADezii
8,834 Recognized Expert Expert
Just as some useless information from ADezii, if you have a Text Box on a Main Form named txtTest, and you wish to set Focus to it from a 3rd Level Sub-Form, namely: Sub-Form1 ==> Sub-Form2 ==> Sub-Form3, you can use the following syntax:
Expand|Select|Wrap|Line Numbers
  1. Me.Parent.Parent.Parent![txtTest].SetFocus
NOTE: The Parent Property can be a handy little item to be aware of.
Jul 30 '08 #5
n8kindt
221 New Member
ok, guys thanks for your help. unfortunately, i still cannot get it to work. however, after working on it today i realized i had forgotten there is a tab control thrown into the mix so this might be throwing a wrench in things a bit. i've tried for an hour to use variations of the methods you provided but have had no luck. i'll just post my form hierarchy here b/c it seems like the easiest way to explain the situation

frmDRinput > DailyTotals (tab control) > frmReconciling > frmList > txtProductPurch ased (text control)

i looked at that table that puppydogg posted and while that has a lot of information, it doesn't say anything about a tab control so i'm still lost here lol. thanks again for your help thus far, guys.
Jul 30 '08 #6
puppydogbuddy
1,923 Recognized Expert Top Contributor
i looked at that table that puppydogg posted and while that has a lot of information, it doesn't say anything about a tab control so i'm still lost here lol. thanks again for your help thus far, guys.
Tab control has no impact. See this link:

http://www.mvps.org/access/forms/frm0025.htm
Jul 30 '08 #7
n8kindt
221 New Member
Tab control has no impact. See this link:

http://www.mvps.org/access/forms/frm0025.htm
gosh, i don't know what i'm doing wrong then. i might have to post a copy of my project b/c i can't figure out what is going on...

one interesting thing to note is that at one point i had the form 'frmDRInput' name 'DailyReconcili ngInputDS'... and when i use the builder tool it always refers to it correctly in the treeview but when i paste the code it uses the old name. not sure if that is relevent or not. i doubt that means it is corrupted... right? anyways, i will look into this situation further and if i can't figure it out i'll just post a copy of my database to see if there is something that i'm not doing right
Jul 31 '08 #8
puppydogbuddy
1,923 Recognized Expert Top Contributor
gosh, i don't know what i'm doing wrong then. i might have to post a copy of my project b/c i can't figure out what is going on...

one interesting thing to note is that at one point i had the form 'frmDRInput' name 'DailyReconcili ngInputDS'... and when i use the builder tool it always refers to it correctly in the treeview but when i paste the code it uses the old name. not sure if that is relevent or not. i doubt that means it is corrupted... right? anyways, i will look into this situation further and if i can't figure it out i'll just post a copy of my database to see if there is something that i'm not doing right
Sounds like you have the symptoms of the name autocorrect bug. See this link for details on what it is and how to fix.

http://www.allenbrowne.com/bug-03.html
Jul 31 '08 #9
n8kindt
221 New Member
Sounds like you have the symptoms of the name autocorrect bug. See this link for details on what it is and how to fix.

http://www.allenbrowne.com/bug-03.html
hmmm it didn't exactly say how to fix it other than turning AutoCorrect off... i actually like it so i don't see this one little bump in the road to be worth turning it off. anyways, i spent some more time at it and still have not been able to solve my problem. here's a sample of my database (i programmed it in access 2007 but i converted it to 2003 so everyone can see it). please disregard the bad naming conventions... this was my first project i ever did in access and now is a small part of a much bigger project
Attached Files
File Type: zip sample_accounting (accdb).zip (277.6 KB, 132 views)
File Type: zip sample_accounting (mdb).zip (294.8 KB, 130 views)
Aug 1 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1486
by: Joost | last post by:
Hi to all, I have a subform which changes its Sourceobject, using the following expression: Forms!!.SourceObject = "Subform Deposito Mant" and the focus to the desired control, a textbox calles "TxtMonto"
17
3840
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a record to the subform (based on the value of the combo box) and requeries the subform control. I want the focus to return to the combo box on the...
7
2378
by: Stu | last post by:
Hi, I have a combobox who's values change the recordsource of the form. Within this form, there is a subform, whos records also need to change pending the value in the combobox. I am able to get the main forms values to change, but not the subform. I've only been using Access 97 for about a month now, so it might be fairly simple. Here is...
2
4477
by: James | last post by:
Hi I have set up a subform in datasheet mode containing a second subform also in datasheet mode in order to be able to open it as a subdatasheet. In my application I make the first subform appear and disappear using the Visible property. If I make it visible (in code), open the subdatasheet (via mouse) and click anywhere on the...
2
1383
by: genojoe | last post by:
I have a form with an RTF control and I want to use a subform to do "Find and Replace". Beyond that, I want the subForm to always be on Top when the Parent form has focus but have it not be on top if neither the subform nor parent form have focus. The code that I think should do this is the following. Unfortunately, with this code, the...
1
30442
by: kaeldowdy | last post by:
This one is stumping me! I have a Form/Subform arrangement. The main form is set as a Single Form and the sub form is set as Continuous Forms. On the Form_AfterUpdate event of the subform, I run some code that affects the main form which forces focus *away* from the subform and puts it to the main form. I need to keep focus on the...
1
3228
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working with. If a user enters data in a subform, then directly clicks the command button on the parent form, the data in the subform is not included in...
2
2357
by: JAYR | last post by:
I have a continuous form as a sub-form on a main form. After updating a control on the sub form I perform checks on what has been entered. If it is incorrect i need to set focus back to that control for re-entry. My question is how do I set the focus back to that control - a simple Me..SetFocus does not work. I would appreciate any help. Thanks...
2
2760
by: angi35 | last post by:
I hope this is an easy question for someone out there. In Access 2000…I have a MainForm with a tab control (MAIN TABS) with 7 tabs. Within each tab is a SubForm. Within each SubForm is a tab control (TabCtl0) with 2-6 tabs. Within each TabCtl0, each tab contains a SubSubForm. Each record in the MainForm has an ID Number; the SubForms are...
0
7703
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...
0
8132
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...
1
7678
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...
0
7982
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...
1
5514
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...
0
5222
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...
0
3656
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...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.