473,805 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

triggering a value to be passed from a control on a subform to a parent form


Hi all,
A subForm control, txtTotalSubForm contains a total from one of the fields
on this subForm . The mainForm contains a combo, myCombo which filters, and
updates the details on the subForm. I want this update to pass the value in
txtTotalSubForm to a control txtMainForm, on the main form. Ive tried using
the parent property, but this is not adequate since I must click onto the
subform to trigger it (on current event of the subform).

The code i tried for the update of the myCombo is as follows

----------------------------------------
Private Sub myCombo_AfterUp date()
Me.Controls("My SubForm").Reque ry
Me.Refresh

Me.myMainFormTx tBox = Me.mySubform.Co ntrols("mySubfo rmTotalControl" )
End Sub

----------------------------------------

I know the last line works, since it works from a button, after i've
updated, but not from the combo box update.
Is there some kind of timing issue that im missing. Its like calling on this
before the data is updated?

Any help/Advice would be most welcome.

Gerry Abbott

Nov 13 '05 #1
4 1769
Gerry,
I would try to requery the txtTotalSubForm before your last line.

Arno R

"Gerry Abbott" <pl****@ask.i e> schreef in bericht news:Kj******** ***********@new s.indigo.ie...

Hi all,
A subForm control, txtTotalSubForm contains a total from one of the fields
on this subForm . The mainForm contains a combo, myCombo which filters, and
updates the details on the subForm. I want this update to pass the value in
txtTotalSubForm to a control txtMainForm, on the main form. Ive tried using
the parent property, but this is not adequate since I must click onto the
subform to trigger it (on current event of the subform).

The code i tried for the update of the myCombo is as follows

----------------------------------------
Private Sub myCombo_AfterUp date()
Me.Controls("My SubForm").Reque ry
Me.Refresh

Me.myMainFormTx tBox = Me.mySubform.Co ntrols("mySubfo rmTotalControl" )
End Sub

----------------------------------------

I know the last line works, since it works from a button, after i've
updated, but not from the combo box update.
Is there some kind of timing issue that im missing. Its like calling on this
before the data is updated?

Any help/Advice would be most welcome.

Gerry Abbott


Nov 13 '05 #2
Sorry, that does not work for me.

Thanks for the quick reply.
Added the line as advised (see code below). Still no change.
----------------------------------------
Private Sub myCombo_AfterUp date()

Me.Controls("My SubForm").Reque ry
Me.MySubform.co ntrols("txtTota lSubForm")
Me.Refresh

Me.myMainFormTx tBox = Me.mySubform.Co ntrols("mySubfo rmTotalControl" )
End Sub

----------------------------------------

if I remove the requery then it updates the txt box. But it wont run the
filter.
So once the requery and the assignment are in the same module, it wont work.
Could probably get round this with and sql statement, but thought there
would be an easy way.
Im sure that im missing something simple here.
Any more Advice ?

Gerry Abbott
Nov 13 '05 #3
> Private Sub myCombo_AfterUp date()

Me.Controls("My SubForm").Reque ry
Me.MySubform.co ntrols("txtTota lSubForm")
Me.Refresh

Me.myMainFormTx tBox = Me.mySubform.Co ntrols("mySubfo rmTotalControl" )
End Sub
Gerry,
I don't see the requery in your new code ... Typo?
Should be: Me.MySubform.co ntrols("txtTota lSubForm").Requ ery <<====
However it would not surprise me if it won't work also...
I also recall having these issues sometimes. (Refresh-Repaint-DoEvents, nothing works 'sometimes')
Could probably get round this with and sql statement, but thought there
would be an easy way.

If you can't work it out I would go for the sql-option.
Maybe even in this case I would go for the sql-option right away.
If you rely on a calculated control you never know when Access is ready...

Arno R
Nov 13 '05 #4
Yes Arno, Typo in the mail only (unfortunately)
U know it would give me a big error if i left it out in the code.

Private Sub myCombo_AfterUp date()

Me.Controls("My SubForm").Reque ry
Me.MySubform.co ntrols("txtTota lSubForm").Requ ery
Me.Refresh

Me.myMainFormTx tBox = Me.mySubform.Co ntrols("mySubfo rmTotalControl" )
End Sub

Yeah, Ive run into this problem before.
For the moment, until i get a better solution, ive got a big 'calculate'
button on the form.
(Im not that happy with it, but there you go)

I'll get a better solution if i've time left at the end of the project...
(or unless some person much wiser than I, can supply me a magical
solution....... )

Gerry.
Nov 13 '05 #5

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

Similar topics

2
2090
by: Ima Lostsoul | last post by:
Access XP Access 2002 format. I have a subform on a tab control. The subform has the following code (error trapping removed to make post shorter)... When I close the parent form it goes 100% as designed UNLESS I have used one of the sort buttons to sort the sub form on any given field. If I do sort, there is a delay fo about 5 seconds until after the parent form closes and the previous form re-opens. It appears that there may be...
3
4177
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...
3
1237
by: sparks | last post by:
I am in a subform on a subform and need to get to a subform on a subform...LOL on 2 tabs. so I have FORM MAIN
6
7498
by: Rick | last post by:
I have a main form called frmDemo with a subform frmStageTrack_Sub. On the subform is a Combo Box CboTermID. The frmDemo is tied to tblDemo and the frmStageTrack_Sub is tied to tblStageTrack. What I would like to do is when a new record is created in frmDemo I would like to set the CboTermID on the subform to a default value, say 1, without the user having to set focus on the subform and selecting an item from the combo box. Right now...
5
3240
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used at conventions. I have a main form with two subforms. On the main form, there is a text box that displays the sum of total orders entered in the subform, . I'm trying to create another text box on the main form, that looks at the subtotal...
0
2021
by: BillCo | last post by:
I'm a C# Newbie, so if I've missed the obvious here go easy!!! I have a form opened from a MDI parent. The form has a data bound combo box, with a SelectedIndexChanged event (fills a list view box on the same form depending on selection). It all works fine except when you close either the form itself or it's MDI parent. Somehow as the form is closing this event is triggered, and crashes out with an un- handled error (even though it's in...
2
1772
by: nospam | last post by:
-------------------------------------------------------------------------------- I have a subform with the related IDs for each customer on the customer main form. I have a button on the continuous subform, which will make the main customer record go to that sub related record's customer record. (follow me?) Problem is that once I am at the related record, if I push the button
6
10761
by: solom190 | last post by:
Okay this is the situation I have two forms and they have a 1:M relationship. I don't have enough space screen-wise to do a traditional "drag form to form" to create a subform so what I did was create command buttons that open the subform when I click on it. I added a filter to the VBA that filters the results of the subform to display only records that match the linking field of the two forms. And it those and would filter but..I am having...
0
1373
by: skips84s | last post by:
I have a parent form with four tabbed subforms. On subform x, selecting a value from a combo box should update a few controls on this subform, as well as a control on subform y, all done using dlookups. Each of the controls does have a valid control source in the same table. Right now, I can update the controls on subform x with no problem. When I add the code to update subform y, however, the control in subform y updates and saves the...
0
9718
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
9596
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,...
1
7649
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
6876
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
5544
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
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
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
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
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.