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: - 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.
16 5301 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 -
Me!frmSubform1.Form!frmSubform2.Form!Text0 = "Hello"
-
and it worked.
Delerna 1,134
Recognized Expert Top Contributor
Puppydogbuddy posted while I was posting mine.
:)
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: - Me.Parent.Parent.Parent![txtTest].SetFocus
NOTE: The Parent Property can be a handy little item to be aware of.
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 > txtProductPurchased (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.
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
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 'DailyReconcilingInputDS'... 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
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 'DailyReconcilingInputDS'... 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
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
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
I have Access 2000....would it be possible for you to attach a sample for version 2000? ....if not, maybe a snapshot?
Also, the name autocorrect bug has proven to be problematic. Strongly advise you to turn it off, but that is your decision.
sure here you go. thanks for looking! i will try disabling to see if that does the trick....
I reviewed the layout of your forms and subforms.It looks as shown below:
Main Form............subform control.....subform source obj.........record source
frmDRInput........................................ ......................................ActivityLog
............DailyReconcilingInputDS........frmReco nciling...........ActivityLogQuery
............DailyReconcilingInputDS........frmList .......................ActivityLogQuery
............DailyReconcilingInputDetail....frmDeta il....................ActivityLogQuery
............DailyReconcilingInputDetail........... .................................................
.......................SplitPayment.............fr mSplitPayment........QueryTransaction
So what you have are 3 subforms that are children of the main form, and 1 subform that is the child of the third subform. The links that you were trying to reference were the master links of each subform. Consequently, the links will reference the Parents of each child as ADezii noted previously. Will get back to you later.
Try these references for your master links. The 2000 version you posted has so many other reference errors (wrong report names, query names,etc.)that I do not have the time to debug your entire application could not test the references below.
Main Form............subform control……....………Master Link………………..
frmDRInput........................................ ........................
............DailyReconcilingInputDS......………………Unb ound
............DailyReconcilingInputDS......………………Par ent. DateSignedIN
............DailyReconcilingInputDetail.………………Pare nt.Parent.ID
............DailyReconcilingInputDetail........... .............
.......................SplitPayment...........………… ………Parent.ID
If you are getting errors on the Date function Date(), see this link. The workaround is to substitute >>>>Int(Now()). http://bytes.com/forum/thread824120.html
Try these references for your master links. The 2000 version you posted has so many other reference errors (wrong report names, query names,etc.)that I do not have the time to debug your entire application could not test the references below.
Main Form............subform control……....………Master Link………………..
frmDRInput........................................ ........................
............DailyReconcilingInputDS......………………Unb ound
............DailyReconcilingInputDS......………………Par ent. DateSignedIN
............DailyReconcilingInputDetail.………………Pare nt.Parent.ID
............DailyReconcilingInputDetail........... .............
.......................SplitPayment...........………… ………Parent.ID
If you are getting errors on the Date function Date(), see this link. The workaround is to substitute >>>>Int(Now()). http://bytes.com/forum/thread824120.html
oh man puppydogbuddy i am so sorry. i converted the wrong database to 2000 mdb. that's probably why all those links and references were bad... i couldn't get the parent propert to work for my life. HOWEVER, i figured out a major source of the problem. the sub that was supposed to set the focus was called from another sub which set the focus to another control AFTER the other sub was run--effectively killing any focus the sub had just set. so, after i fixed that problem i was able to set focus 3 deep by doing this: - [DailyReconcilingInputDS].SetFocus
-
[DailyReconcilingInputDS].Form![DailyReconcilingInputDS].SetFocus
-
[DailyReconcilingInputDS].Form![DailyReconcilingInputDS].Form![ProductPurchased].SetFocus
tadaa! i finally got it to work. once again though, i couldn't get the parent property to work. in fact everytime i tried to add a period after typing in me.parent vba beeped at me as if to warn me i couldn't do that. i'm wondering if you guys misunderstood what i was trying to do b/c everywhere i looked on the web, the parent property was supposed to reference an object that is a parent to the subform. so idk what to make of that. anyways, got it to work--that's the important part. and thank you puppydogbuddy for all of your trouble.
cheers,
nate
Glad you got it resolved......and that the original syntax we gave you worked after you discovered the cause of the problem.
Glad you got it resolved......and that the original syntax we gave you worked after you discovered the cause of the problem.
i know... sorry to get you all involved with that over a mistake on my part. thanks again for your help.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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,...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
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...
| |