473,883 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Requery Subform

12 New Member
How to requery the subform based on date range after update in Main form. Example: The forecast quantity in main form was revised based on the new startdate and enddate. How do I requery the subform in order to revise the forecast quantity?

Thanks for any help.
Elizabeth
Sep 23 '12
16 20903
ElizabethLOng
12 New Member
Want to replace just the records selected in the subformm based on the revised quantity in the main form. Tank you and regards EOL
Oct 1 '12 #11
Seth Schrock
2,965 Recognized Expert Specialist
When you say Records, I'm assuming multiple records. How are you selecting the multiple records? Do you have checkboxes or are you just using the Ctrl or Shift buttons to select the ones that you want?
Oct 1 '12 #12
ElizabethLOng
12 New Member
I filter the records based on date range using the above code.
Oct 2 '12 #13
Seth Schrock
2,965 Recognized Expert Specialist
You said, "Want to replace just the records selected in the subformm based on the revised quantity in the main form."

What method are you using to select the records in the subform? At this point, I don't need to know how the subform information is generated, but how are you selecting the individual records? A checkbox?
Oct 2 '12 #14
zmbd
5,501 Recognized Expert Moderator Expert
Seth, ElizabethLOng;
I've been following this for a little while now and now I'm wonder if we have a mis-communication.

EL:
When you say "replace" most people, in my experience, will tend to understand you to mean, that the item (record) is discarded and a new item is put in it's place... think changing the tires. If I replace the front driver-side tire, the old tire is sent to the rubish/recycle bin and a new tire from inventory is put into service.

If what you want is a new selection of the records... then the analogy might be along the lines of tire rotation in that one or two of the tires you see in the driver's side might trade sides with the passenger. You haven't replaced the tires, you have a different view.

::
We do need to understand the real structure underneath the database and the forms.
::

- What version of MS Access are you using?

- From what I understand, there are two related tables that are being used for the forms; is this correct?

- From what I understand, there are two forms, one form is based on one of the afore mentioned tables and the the second is bassed on the the other table; is this correct?
Oct 2 '12 #15
ElizabethLOng
12 New Member
Sorry it took me sometime to reply, still trying to work out my code. I am using MS Access 2007. My code can filter records in the subform based on the date range entered in the main form. The problem with my code after filtering the subform it only refreshed the first record, is there a way to refresh all the filtered records? I need to constantly change the quantity at a certain date range in the subform based on the revised quantity in the mainform. Thanks for your help.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Image87_Click()
  2.     Dim strFilter As Variant
  3.     Dim strSDate As String
  4.     strSDate = Me.SDate
  5.     Dim strEDate As String
  6.     strEDate = Me.EDate
  7.  
  8.     'check sdate
  9.     If Not IsDate(Me.[SDate]) Or Not IsDate(Me.[EDate]) Then
  10.         MsgBox "Valid dates must be entered"
  11.         Exit Sub
  12.     End If
  13.     If Me.[EDate] < Me.[SDate] Then
  14.         MsgBox "End date must be later than start date"
  15.         Exit Sub
  16.     End If
  17.  
  18.     'if both sdate and edate are valid, run filter
  19.     strFilter = "[sfmDDate] BETWEEN " & Format(Me.SDate, "\#mm\/dd\/yyyy\#") & _
  20.                 " AND " & Format(Me.EDate, "\#mm\/dd\/yyyy\#")
  21.     Forms!FormName!SubformName.Form.Filter = strFilter
  22.     Forms!FormName!SubformName.Form.FilterOn = True
  23.     Forms!FormName!SubformName.Form!SubformControlName = Me!FormRevisedQTY.Value
  24.  
  25. ExitSub:
  26.  
  27. End Sub
  28.  
Oct 7 '12 #16
zmbd
5,501 Recognized Expert Moderator Expert
try inserting: Forms!FormName! SubformName.For m.Requery after line 23 of the posted code.

You'll also find the following insight article (and the refered to cascade) to be of interest: http://bytes.com/topic/access/insigh...filtering-form
... http://bytes.com/topic/access/insigh...mbo-list-boxes
and the overall map is at the bottom of this page "Microsoft Access / VBA Insights Sitemap" scroll down there... TONS and TONS of information!
Oct 7 '12 #17

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

Similar topics

0
429
by: Michelle | last post by:
Hi all I have a main form which has a combo box and a subform. The two forms are linked by ShiftPatternName which is basically the value in the combo. the combo has the following code Me.RecordsetClone.FindFirst " = '" & Me! & "'"
2
2116
by: amywolfie | last post by:
I have read the other posts on this topic, but didn't find an answer specific to what I need. I have a main form: frmFeeInput, which contains 2 subforms: 1) sfrmFootnotes 2) sfrmLoanProducts When a data field in sfrmLoanProducts has a given primary key (referenced in an IF statement in VBA), then I need to insert a record into the Footnote join table.
4
4574
by: mooseshoes | last post by:
All: Form A: Main_Form Form B: Sub_Form (has the control name: Sub_Form_Control_Name) Form C: Independent_Form Form C is based on a table which is also used by Form B. When Form C is used to update the table I want to requery and redisplay the data in Form B.
14
11479
by: Kurt | last post by:
I have an unbound main form with an unbound subform. frmProjects fsubProjectList Using combo boxes, the user can select several search criteria on frmProjects and then click a command button. The command button passes the criteria as a string to a query. A subform, which is based on this query, shows the results of the search.
7
4104
by: SBC News Groups | last post by:
I have a form that the user enters some information on and then clicks a button to save the record. I do with the following line: DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 Once this line executes, I have a sub form that I want to "refresh" because the newly saved information should now display on the sub form. I am trying to do this with this line: Forms!.Requery
1
3161
by: Alessandro | last post by:
Io devo aggiornare i campi di una sottomaschera. Con una maschera normale uso il comando docmd.requery !! ma con una sottomaschera non so come scrivere il codice
3
3460
by: LROCCO | last post by:
Hi, I have a form which contains a subform. When I'm entering data into the subform it seems to requery automatically. When this occurs the focus goes to the start of the subform. Firstly, do subforms requery automatically? ....and if so can this be stopped?
2
1978
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 goofy name for a car existed) would return. The problem I am running into is with the subform on...
0
9786
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,...
0
11125
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10407
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7114
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
5794
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
5982
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4607
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
4211
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3230
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.