473,508 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Requery Subform upon clicking a button in the main form.

1 New Member
I want to update the subform upon clicking a button (Run) in the main form. The Run button on the main form is updating a query(Filter Region). This query is the Source Object of the Subform.

The query is getting updated upon clicking the Run button but the Subform is not. The code written for the Run button on the main form is:

Private Sub Run_Click()
DoCmd.OpenQuery "Filter Region", asViewNormal, acReadOnly
End Sub

I think, by modifying the code of the 'Run' button we can update the subform.
Please suggest.
Dec 14 '15 #1
2 5470
mbizup
80 New Member
Try adding a line of code to your sub, after the OpenQuery. The general syntax for a main form requerying a subform is:

Expand|Select|Wrap|Line Numbers
  1. Me.MySubformControlName.Form.Requery
Where MySubformControlName is the name property of the control that houses your subform (in the main form's design view). This is usually, but not always the same as the name of the subform as seen in the navigation pane/database window.
Dec 14 '15 #2
jforbes
1,107 Recognized Expert Top Contributor
In this case, the SubForm is calling the Query and displaying the Results, so you'll want to tell the SubForm to get the latest results. Something like this should work for you.
Expand|Select|Wrap|Line Numbers
  1. Me.NameOfSubForm.Form.Requery
You'll need to replace the NameOfSubForm with the real name of the Control that contains the SubForm. ...It really needs to be the Controls name.
Dec 14 '15 #3

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

Similar topics

2
8291
by: chris vettese | last post by:
I've been having trouble with this for a long time. I have a form that has many subforms. In the subforms I have unbound text boxes in the footer that sum a field. I want to Display this sum on...
1
2130
by: Argus Rogue | last post by:
Hello All Access Guru's: I was wondering if you could assist me with a little problem that I am having using subform. Is it possible to scroll down a subform to a particular record, click on...
6
2243
by: MLH | last post by:
I don't always get what I want when I invoke the following Me!MySubFormControl.Refresh from code running in the main form. Am I doing something wrong here? Someone suggested that I open the...
9
8072
by: freeskier | last post by:
I am working on a form to edit student field placements. the student is selected from a combo box (cboStudent) which then populates a list box(lstPlacements) with field placements for that student....
2
6911
by: rlamber | last post by:
Hello, I have 2 subforms in a Main form, one links fine, the other doesn't. I am trying to link them both to a "tracking ID" on the main form. The Tracking ID is a text field that is a combination...
5
2704
JustJim
by: JustJim | last post by:
I must have Friday-itis! I have a main form which has a sub-form. The sub form is shown as a datasheet, but in design view I have a control on the Form Footer which totals a field on the Detail...
1
2294
by: Moish | last post by:
I have a form that does not have any bound fields. I want to open a subform on that form to a specific record based on the value of an unbound field on the main form. Obviously the subform is not...
1
2643
by: greenstein | last post by:
Hello, I really need some help. I have a main form in Access 2000, with a subform, some of the fields in the subform are not saving to the table. When I search the Main form for the information,...
1
2243
by: dekk | last post by:
Hi, I have a main form ("frm_TimeParent") and a subform ("frm_TimeChild"). Issue: How do I refresh the combo box values in the subform once the contract has been selected in the main form? ...
4
3507
sueb
by: sueb | last post by:
ADezii helped me with this once, but I must have messed it up somehow and can't figure it out again! All my forms are opened either in Dynaset or Snapshot mode, depending on whether the user has...
0
7225
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
7324
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
7382
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...
1
5052
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
4707
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...
0
3193
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...
0
3181
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1556
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
418
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.