473,738 Members | 10,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you refer to a control on subform inside a tab control?

Hi,

(Using Access 2000)

I have two tables, similar to Customers and Orders. (Not an exact
parallel, but works for this example.)

On a form showing customer data, there is a tab control. One of the
tabs has a subform showing order data (in datasheet view). On the same
tab there is an unbound textbox (next to the datasheet). I placed a
command button that runs code to add the QTY from each line in the
subform and put the sum in the unbound textbox. That works, but when
you edit the QTY the total does not change until you click the button
again. I tried using AfterUpdate on the QTY field in the subform, but
an error always occurs when I try refer to the textbox.

I have tried about 9 different implicit/explicit references to the
textbox, but the procedure is just not recoginzing it.

Is it possible to refer to a control within the tab control of a form
from a subform inside the same tab control? How?!

Any help is greatly appreciated!

Thanks,

~Joshua Ammann
Nov 13 '05 #1
3 4143
From code in the Form embedded in a Subform Control, to refer to a Control,
txtX, on the main (parent) Form:

Me.Parent!txtX = <the value you want to set>

For Controls on a Tab, you don't have or need a reference to the Tab Control
or Tab Page.

Larry Linson
Microsoft Access MVP

"Joshua Ammann" <jo****@ammann. com> wrote in message
news:32******** *************** ***@posting.goo gle.com...
Hi,

(Using Access 2000)

I have two tables, similar to Customers and Orders. (Not an exact
parallel, but works for this example.)

On a form showing customer data, there is a tab control. One of the
tabs has a subform showing order data (in datasheet view). On the same
tab there is an unbound textbox (next to the datasheet). I placed a
command button that runs code to add the QTY from each line in the
subform and put the sum in the unbound textbox. That works, but when
you edit the QTY the total does not change until you click the button
again. I tried using AfterUpdate on the QTY field in the subform, but
an error always occurs when I try refer to the textbox.

I have tried about 9 different implicit/explicit references to the
textbox, but the procedure is just not recoginzing it.

Is it possible to refer to a control within the tab control of a form
from a subform inside the same tab control? How?!

Any help is greatly appreciated!

Thanks,

~Joshua Ammann

Nov 13 '05 #2
Thanks Larry, but I guess I was not so clear in my explanation. The
control I want to set is not on the main form. It is on a page of the
tab control, beside a datasheet subform.

Here is the actual code that works on the main form's "On Current"
event. When I place it on the "After Update" event of the Qty field in
the datasheet subform, it gets to the point noted below and can't find
the controls inside the tab control.

Like I said, I've tried every reverence path I can think of and no
dice.

Any ideas? Anyone?

'Code Start
Private Sub Form_Current()
Dim qdf As QueryDef, dbs As Database, rst As Recordset
Dim iON, iOFF As Integer
iON = 0
iOFF = 0
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs(" qryCount")
'Query contains [SiteIndex], [ON-or-OFF_System] and [Qty]
Set rst = qdf.OpenRecords et(dbOpenDynase t)
rst.MoveFirst
Do While Not rst.EOF
'Check if the row in query matches the record on main form
If rst![SiteIndex] = Me![SiteIndex] Then
'Check either ON or OFF System
If rst![ON-or-OFF_System] = "ON-System" Then
'Add Qty from query to variable to count ON Sys
iON = iON + rst![Qty]
Else
'Add Qty from query to variable to count ON Sys
iOFF = iOFF + rst![Qty]
End If
End If
rst.MoveNext
Loop
'Assign the variables to unbound controls on the form
'The controls below are on "Page2" of control "TabSubform 1"
'on form "frmSurveyD ata"
'*****This is where the error occurs with AfterUpdate**** *
CountON = iON
CountOFF = iOFF
CountALL = iON + iOFF
End Sub
'Code End

Thanks,
~Joshua Ammann

"Larry Linson" <bo*****@localh ost.not> wrote in message news:<5XJ%c.52$ tJ1.37@trnddc04 >...
From code in the Form embedded in a Subform Control, to refer to a Control,
txtX, on the main (parent) Form:

Me.Parent!txtX = <the value you want to set>

For Controls on a Tab, you don't have or need a reference to the Tab Control
or Tab Page.

Larry Linson
Microsoft Access MVP

"Joshua Ammann" <jo****@ammann. com> wrote in message
news:32******** *************** ***@posting.goo gle.com...
Hi,

(Using Access 2000)

I have two tables, similar to Customers and Orders. (Not an exact
parallel, but works for this example.)

On a form showing customer data, there is a tab control. One of the
tabs has a subform showing order data (in datasheet view). On the same
tab there is an unbound textbox (next to the datasheet). I placed a
command button that runs code to add the QTY from each line in the
subform and put the sum in the unbound textbox. That works, but when
you edit the QTY the total does not change until you click the button
again. I tried using AfterUpdate on the QTY field in the subform, but
an error always occurs when I try refer to the textbox.

I have tried about 9 different implicit/explicit references to the
textbox, but the procedure is just not recoginzing it.

Is it possible to refer to a control within the tab control of a form
from a subform inside the same tab control? How?!

Any help is greatly appreciated!

Thanks,

~Joshua Ammann

Nov 13 '05 #3
The Tab Control is a non-issue. Just refer to the target control as
if the Tab Control did not exist.
On 9 Sep 2004 05:48:50 -0700, jo****@ammann.c om (Joshua Ammann) wrote:
Thanks Larry, but I guess I was not so clear in my explanation. The
control I want to set is not on the main form. It is on a page of the
tab control, beside a datasheet subform.


Nov 13 '05 #4

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

Similar topics

6
3123
by: octagon | last post by:
Hi, I have a form with various types of control such as txtbox, combo box, listbox, subform and check box I am trying hard to write a code for a check box after check the box all the control in form shall be disable. my code is as follows; If checkbox1 = true then txtbox.enabled = false listbox.enabled = false blah...blah..blah... else
5
2396
by: Georges Heinesch | last post by:
Hi. Is it possible to put a tab control inside another tab control. I tried it several times, but for some reason this doesn't seem to work. Can someone confirm this, or tell me what the trick is. Thanks. --
4
6560
by: solar | last post by:
How to refer to a subform ? On my main form called FrmEmployees I have a button to open a report. I want to forbid opening the report in case the liters in the subform are 0. To this end I have build an If condition: Dim ClLiters As Control ClLiters = Forms!FrmEmployees!FrmEmployeesSub.Form!liters If IsNull(strLiters) Then
3
4174
by: Not Me | last post by:
Hi, Just trying to get my head around tab controls, is there anywhere which would describe the structure of how they work? I seem to be ok so far, being able to check which page I'm on etc... but I'm at a loss when trying to access controls inside the tabs. If I try to access the form directly (!...etc.) I get an error that the form can't be found. I'm not sure how I can use parent/child relationships to get at the (sub)forms which...
1
3039
by: MP | last post by:
I have a main form that has a subform which also has a subform: the main form is the first subform is the second subform is When I click on the button »AddNewSubSubRecord« (add a new record in the second subform , the code generates the message: Can't find the field »POG-03 Work Subform« reffrred to in your expression.
2
11291
by: Michael R | last post by:
This is something I haven't found about on the net, even though it seems to me like it could be a common question. The task is simple: I have a ControlName.Value which is on Subform which is on page 1 of a TabCtrl. I've tried - (I'm not using code brackets, since this is an incorrect code) Me!TabCtrl.Form!2!Subfom.Form!NameControl.Value = Me.Name2.Value and Me!TabCtrl!2!Subform.Form!NameControl.Value = Me.Name2.Value What is the...
7
12307
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm thinking the Table will stay open otherwise ??? - Do I also need to use code to Assign the Child&Master Links, or can I just type the names into the subForms Control Property and just depend on the SourceObject to link to Table???
6
5089
by: colin spalding | last post by:
Access 2003 I subform which lists financial transactions for a client in the main form, which i total in a textbox named "txtTotalPremium" in the subform footer with the Control Source "=Sum()"; without quotations of course. This works fine until the subform has no records to return in which case textbox is blank. That would be fine except I need to use the figure in another text box on the main form as part of another calculation. I...
5
17607
by: ChipR | last post by:
Question: Can I set a form's variable from another form? Details of my problem: In my Form1, I have Option Compare Database Option Explicit 'whether each tab has been updated, so they aren't recalculated unneccesarily Dim tab0 As Boolean
0
8969
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
9476
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
9335
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
9263
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
9208
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
6751
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
4570
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...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
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.