473,395 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

158 100+
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_(RefreshAll)would truly be an amazing function
Feb 7 '11 #1

✓ answered by TheSmileyCoder

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

6 20361
TheSmileyCoder
2,322 Expert Mod 2GB
*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 Expert Mod 2GB
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 100+
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 "subLocation" 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, 1198 views)
File Type: jpg popup.jpg (44.5 KB, 1297 views)
Feb 8 '11 #4
TheSmileyCoder
2,322 Expert Mod 2GB
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 100+
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
Brilliant! Thank you
Mar 22 '14 #7

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

Similar topics

0
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...
0
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)...
1
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:...
4
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:...
3
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...
4
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) {...
1
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...
4
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...
2
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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
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
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
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,...

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.