473,544 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to requery a subform at closing of a popup form?

158 New Member
I use a popup form to write the "ToDo" portion of a record. Once I close the popup form I would like
Expand|Select|Wrap|Line Numbers
  1. [Forms]![LocationsTF]![LocationSubTSF].[Form]![CurrentRepairs4LocQF].[Form]
to be refreshed with the new information that I just wrote in the popup form that I just closed. I don't know why I always end up with this same problem every time; every time there is a different way of refreshing a subform. One day someone really amazingly bright will be able to write the most amazing function in the world "Refresh all".

OnClose_(Refres hAll)would truly be an amazing function
Feb 7 '11 #1
6 20395
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
*IF* your opening your form from code you can simply do:
Expand|Select|Wrap|Line Numbers
  1. docmd.OpenForm "frm_Popup",acNormal,,,acFormPropertySettings,acDialog
  2. Me.subFrm.Requery
Since the frm_Popup is opened in DIALOG mode, the code will not continue to the next line until you close the popup.

or in the close event of your popup:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2.   Forms("frm_Main").Requery
  3. End Sub
Feb 8 '11 #2
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I have written some code to requery all open forms. I haven't tested how it works on subforms, so why don't you do that yourself and report your results.
Expand|Select|Wrap|Line Numbers
  1. Public Sub requeryAllOpenForms()
  2.     Dim frm As Object
  3.     For Each frm In CurrentProject.AllForms
  4.         If frm.IsLoaded Then
  5.             If frm.CurrentView <> 0 Then 'if currentview is 0, frm is loaded in design view
  6.  
  7.                 Forms(frm.Name).Requery
  8.  
  9.             End If
  10.         End If
  11.     Next frm
  12.  
  13. End Sub
Feb 8 '11 #3
jaad
158 New Member
It is a little bit more complicated than what it seems. If you open up the picture "Locations" you will see the form where it all start. When I click [repairs]for an item in the sub-location form, a a "popup repair form" pops up so I can write what I need to do with this {item} that is in a "sub2nd location" which in turn is in a "subLocatio n" which in turn is in a "unit" which in turn is in a "building. " Notice at the top left I have a bunch of IDs reference that comes from many tables. if I requery the form, each sub section of the form default back to the first record in tables which mean I have to backtrack the hierarchy of forms in order to see the result in the "current repairs" subform. What I have been doing to refresh the view is simply change record and work my way back but it is time consuming. Ideally I would need the requery JUST the last form that I wrote in my first message. is that possible?
Attached Images
File Type: jpg currentRepairs.jpg (42.7 KB, 1081 views)
File Type: jpg Locations.jpg (41.5 KB, 1199 views)
File Type: jpg popup.jpg (44.5 KB, 1300 views)
Feb 8 '11 #4
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
You should be able to modify the code i gave in post 2:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2.   Forms("LocationsTF").[LocationSubTSF].[Form].[CurrentRepairs4LocQF].Requery
  3. End Sub
Feb 8 '11 #5
jaad
158 New Member
LOL it works! For some reason Which I don't know why it didn't want to work before when I used the line. THis is something that happens very often with my database codes. Sometime they work and sometime they don't. Sometime I will be using a function for a month and then suddenly it stops working for no reason. Is there some sort of bug in Access 2007 with this matter?

by the way thank you very much for your patience and for helping me out... ;0)
Feb 8 '11 #6
Romain
1 New Member
Brilliant! Thank you
Mar 22 '14 #7

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

Similar topics

0
1422
by: Deano | last post by:
I have a main/subform arrangement which works well. The main form's parent records are about employees. The subform calculates their salary. I have now decided that the user can enter some splits in a popup form that I have built. So they click the Splits button and they can enter e.g 0.4 and 0.6 or any combination as long as it comes...
0
1156
by: RookieCard | last post by:
I've been stuck on this for 2 days. Here's the deal. I am working (3 levels down/deep)in a subform within a tab object that is within another tab obeject. Everything works great! Except here: 1) 3 levels down I have a command button labled "show client address" that launches a macro that evaluates a yes/no condition in a field on the same...
1
1677
by: ken | last post by:
Hi, I have a MainForm and a SubForm. I also have a popup form that is opened by a button click on the subform. On that form I want to set the main form and subform. to set mainform you do this: dim f as form f = forms("MainForm") ---this works
4
1504
by: ken | last post by:
Hi, I have a MainForm and a SubForm. I also have a popup form that is opened by a button click on the subform. On that form I want to set the main form and subform. to set mainform you do this: dim f as form set f = forms("MainForm") ---this works
3
12802
by: ken | last post by:
Hi, I have a main form with a text box and a filter button. I also have a subform in the main form. When I make an entry into the filter text box and click the filter button, I change the query definition of the subform and then try to requery the subform, but no matter what I do it does not requery? While my main form is open and after I...
4
2993
by: SteveS | last post by:
Hello. This is a strange problem which does not make sense to me. I open a popup page with the following javascript code: function OpenDenyWindow(changeId) { retVal=window.showModalDialog('DenialEmailForm.aspx?id=1234'', 'dialogWidth:650px; dialogHeight:700px; resizable:no;'); //alert("Return val = " + retVal) }
1
3533
by: calebm12 | last post by:
Previously i had a combo box where i could select a name and then click a button and a subform on that form would requery and give me the information i wanted. However, i have now changed the combo box to a list box...and am having a difficult time integrating the requery feature. in short i have strWhere = " = " For Each varItem In...
4
8812
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form which allows me to edit the record in the subform. What I want to happen is for subform with the new edits to be updated on the main form when I...
2
4319
by: Del | last post by:
I have a popup form that consist of a single field called EnteredBy and a Subform that has three fields. The popup form also has a button in the Form Footer called close. In the On Click event I have the following code. DoCmd.Close I want the EnteredBy field to be a required field. So in the On Exit event for that field I have the...
2
1960
by: bbatson | last post by:
Hello, I have created a form that allows the user to search a sales table with the option to choose 1) a sales representative and 2) a car type matching any portion of the inputted text. For example, you can choose "Joe Smith" as your salesman and type "mus" in the search box and all sales by Joe Smith selling a Mustang or a Mustafa (if such a...
0
7417
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
7361
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...
1
7365
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
5901
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5289
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
4908
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
3404
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...
1
1834
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
0
654
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...

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.