473,480 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I update textbox on Mainform on close of dialog window?

4 New Member
I am building in Access 2013

I am using Navigation forms.

My main forms is frm_orders
- It has the field (bound) txtOrderTotal

My subform is frm_orderdetails
- It has the (unbound) field txtSubTotal

My dialog form to add items to order details is frm_AddItem
- It has cboProduct, txtUnitPrice, txtQty

Currently working - When I add a new item in my popup form and save it adds the item to the subform and changes the txtSubTotal

What I can't seem to do on close of the frm_AddItem is take the txtSubTotal from the subform and place it in txtOrderTotal on the main form.

I've tried accessing the text box via normal method Forms!frm_order!txtOrderTotal and Me.txtOrderTotal but vba just throughs a wobbly saying it can't find the field.

Is it because I am using Navigation forms.

Attached Images
File Type: jpg naviation_forms.jpg (20.4 KB, 797 views)
Jan 15 '14 #1
11 2354
zmbd
5,501 Recognized Expert Moderator Expert
1) Why?
2) show the formula/code you are using. Please format using the [Code/] button.
Jan 15 '14 #2
NeoPa
32,556 Recognized Expert Moderator MVP
I suspect you need to tell it to requery.
Jan 15 '14 #3
zmbd
5,501 Recognized Expert Moderator Expert
Neo is more than likely correct; however, the navigation control has an unusual property and we need to see the refering formula/code.

If OP will search on ZMBD and "Navigation Control" I've covered this before... http://bytes.com/topic/access/answer...ntrol-subforms I've made two such posts that cover the basics of using the Navigation Control.
Jan 16 '14 #4
mashman
4 New Member
I was planning on having a Total field in the Orders Table so I could call upon it throughout the database which is why I wanted to populate that field from the field in the subform.

I have decided to get rid of the Total field and I will instead calculate the total as and when I need it by adding line items in order details table as and when I need it.

I am finding Navigation forms frustrating at times as searching around on the web mainly produces non navigation form coding which doesn't work.

I have added your link to my delicious links thanks zmbd, and did the same for the other post you helped me with here on nav forms http://bytes.com/topic/access/answer...ba#post3763553
Jan 17 '14 #5
zmbd
5,501 Recognized Expert Moderator Expert
ah... something just occured to me...
the new tempvar available to ACC2010
[http://msdn.microsoft.com/en-us/libr....aspx]tempvars object [/url]

I've only been playing with these for a very short while. The object stays stable until you remove it or the session closes, can be used in a query, and is one of the very few objects that both the Macro and VBA can both workwith.
Here's a thread that goes over modifiying an exsisting code to to work with it... really straight forward: http://bytes.com/topic/access/answer...on#post3761896

What I see here, to avoid the nasty navigationsubform reference is to create the variable and from the subform store your value there and the set the controlsource of your unbound textbox to the tempvar...


and Thank You (^_^)!
Jan 17 '14 #6
NeoPa
32,556 Recognized Expert Moderator MVP
I believe TempVars persist beyond the closing of the session. They are available for the life of the Access Application they are set in, or at least until the database is closed.
Jan 18 '14 #7
ADezii
8,834 Recognized Expert Expert
Temporary Variables are Global and will remain in memory until the Database is closed which is why Temporary Variables should be removed when you are finished using them (RemoveTempVar for individual removal/RemoveAllTempVars collectively).
Jan 18 '14 #8
zmbd
5,501 Recognized Expert Moderator Expert
I may have the wrong term here.
In my mind for Access a session starts when the user opens the application and ends when the user closes the application.
I was not aware that the object would persist if the database was closed and the Access program remained open. I'll check that out in a momement.
Jan 18 '14 #9
zmbd
5,501 Recognized Expert Moderator Expert
(although not best practice)

I set up a series of tempvars.* within a database application.
Obviously, closing the Access Program removed the object; however, so did closing the database front end and the all-in-one database.
At no time did I clear the tempvars collection via code, and I state again, if you open it close it, if you set it clear it (^_^).

Thus, I stand by my concept of a session being the point at which the database application is opened to the point it is closed by the end user.
Jan 18 '14 #10
NeoPa
32,556 Recognized Expert Moderator MVP
For me, a session is a code session.

Access can open an application window.
In the Access window you can have multiple databases open for direct interaction with the user, but only ever one at a time.
Once a database is open there is a code context, or session, that is maintained until it is stopped or reset. After that it can be restarted.

Sessions are stopped whenever code is cancelled after a bug or the Reset button (in the VBA IDE) is pressed.

I believe TempVars persist for an open database. Beyond such sessions, but not after the database is closed.
Jan 18 '14 #11
zmbd
5,501 Recognized Expert Moderator Expert
We may have to have some sort of new word for the tempvars object. (^_^)

I have not tried the to use these between two different frontends/databases opened thru the same instance of the Access application. I suspect though that the scope is within the frontend/database-file that created the collection.

What I do know, is that they persist within a given frontend/database until that database is closed or they are explicitly cleared; they do not clear if there is an error (unlike global variables); and they may be an option for OP to workaround the cumbersome subcontrol references within the acc2010:navigation control.
Jan 18 '14 #12

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

Similar topics

3
17755
by: Svennglenn | last post by:
Hi I'm creating a program in Tkinter and I would need help to create a "close button" for dialog windows. One of my typical dialog windows look like this: def show_window(self): top =...
2
6499
by: Matt | last post by:
I reposted this question because I really want to accomplish this task. Please advise!! I want to post the form data (http://server/page1.asp) to a modal dialog window...
2
3855
by: Matt | last post by:
I want to know how to submit the form data to a modal dialog window? The following is page1.asp, and when the user clicks submit button, it will post the form data to page2.asp by opening a new...
10
37968
by: Shang Wenbin | last post by:
Hi, When I want to close the current window using window.close() in IE6.0, there will be a confirm box that: The web page you are viewing is trying to close the window. Do you want to close this...
2
7070
by: John | last post by:
Hi all, I have a modal dialog window from which a user selects a few rows from a datagrid and then clicks on an image button. My question is two-fold: 1. How do I post data back to the same...
7
2210
by: mg | last post by:
Once opening WebForm2 from WebForm1 using Response.Write("<script language='javascript'>window.open ('WebForm2.aspx','two','menubar=no');</script>"); how can I close WebForm1?
7
2700
by: mg | last post by:
I need to first open WebForm2 from WebForm1 and then close WebForm1 without the end user having to press an OK button before the close can occur. For example, possibly ...
1
2257
by: Grey | last post by:
I use window.showModalDialog("AddBoktype.aspx") to create the dialog window. When I use a button, ASP.NET server control button, to close with btnCancel.Attributes.Add("OnClick","window.close();")....
1
1020
by: bhappy | last post by:
Hi I want to close a modeless dialog window on the click of submit button .During click of submit button i am saving data to database and Postback the data entered in child window to parent...
1
4469
by: Ramachand | last post by:
Actually I have to call a dialog window "Dwin1" from a Parent Window. From Dwin1, I have to call another Dialog Window "Dwin2".if user close the Dialog Window "Dwin2", i have to refersh the Dwin1....
0
7041
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,...
0
7044
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,...
0
7084
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...
0
6929
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...
0
5337
agi2029
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,...
1
4779
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...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
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 ...
0
181
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...

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.