Forms :: How To Use GROUP BY In Form Filter
Apr 1, 2013
I have developed an accounting database which includes, among others, tables for Transactions and Creditors. I want to query the data for a particular time period to find out how much I have paid to each creditor. At the moment I can do this by having a Main Form based on Creditors, and a subform based on Transactions that contains a filter to display only those records that fit into the selected time period.
Now, there are some creditors to whom I have paid nothing during that particular period, so the subform shows no records. That's fine, but as I have several hundred creditors, it's tedious to pan through each creditor to see if I have paid anything.
What I want is for the subform to display records from ONLY those creditors to whom I have paid something. I can view these records with a select query by using the GROUP BY function. However it seems that a form's filter property will not accept a WHERE clause that includes a GROUP BY clause.
How I can program this in VBA, i.e. to mimic a select query's GROUP BY function for use as a form filter?
View Replies
ADVERTISEMENT
Aug 1, 2013
I have placed a filter button on a form as a filter and written the following on-click event procedure:
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdApplyFilterSort
Me.Filter = "ACCOUNT_DO_NOT_EMAIL = 'HS'"
Me.FilterOn = True
When I click the filter button I get a blank message box titled 'Microsoft Access" and an OK button, when closed the filter works perfectly.I have checked this procedure in other forms and it works without showing the blank message box.The only difference with this form is that its control source is a union query.
View 10 Replies
View Related
Sep 18, 2014
I have a form which is bound to a table. This table has lots of field, consequently lots of textboxes on my form.
Is it possible to group some of the textboxes together and minimize them. Sort of what the group function does on excel?
View 1 Replies
View Related
Aug 8, 2013
I'm developing a database where people basically can fill in an order form and then the database can track if the order has been placed, when it came in etc.I have a form called frm_Suppliers to be Ordered that runs off a query. The tables that relate to the query are called tbl_Products, with a primary key called ID and tbl_Suppliers, with a primary key called Supplier ID.
The form called frm_Suppliers to be Ordered, shows a list of suppliers that have open orders. Each supplier may have several orders open. I want to be able to click a button after each supplier name and bring up a continuous form that relates to all the records from that supplier that have open orders.
I have tried using the code found in the thread called "open a form based on the record that is selected in current form" from 06-08-2011, however it will only work when my form lists each open order separately, not when they are grouped by supplier.
View 2 Replies
View Related
Feb 2, 2014
I have a query that i need to run from a form. From form I need to pass criteria
1 for canada
2 for us
1 and 2 for us and Canada
The criteria needs to go into field Pricing Type. If user selects 1 then only Pricing Type 1 will display. If user selects 2 than only Pricing Type 2 should display. I user selects both , Pricing Type 1 and 2 should be listed.
Can this be achieved with option group?
View 2 Replies
View Related
Dec 27, 2014
When I'm applying a sort and filter in a form, Access is updating the Filter and Order By properties of the form, so that it is possible to re-use in conjunction with Filter on Load and Order By on Load properties. However, a consequence of this is that when the form is closed, it prompts the user whether they want to save the design of the form. I want to circumvent this as I don't want to re-use the sort and filter and I don't want to be prompted to save the design of the form.
Although I can circumvent this by closing the form using a method that doesn't prompt for saving, the additional complication here is that the form in question is in the Navigation subform of a Navigation Control. Hence when I click on a another Navigation button, it (not me) closes my current form and hence prompts me whether I want to save the design of the form (if I have been sorting and/or filtering). I can't see how to circumvent this and the prompting is resulting in unacceptable usability.
View 2 Replies
View Related
Mar 2, 2015
I can understand with placing a filter on a form.I have a table that needs updating. I created a form based on the table, but would like to only see the records that need updating, instead of the entire table.
I have no SQL knowlegde. Is there some simple answer? I would like to filter on one field for the word "NO" ie seeing only the records which contain NO in that field.
View 10 Replies
View Related
Jan 14, 2015
On a form I have a:
control called "FilterListBox"
list box called "lstCustomer"
option Box called "optCustomerType"
When the user selects an option in the option box, "FilterListBox" is updated to either "1", "2" or "1 or 2"..One of the fields in the query for "lstCustomer" is "CustomerType" and its criteria is set as follows:
[Forms]![frmPrintHowCustomersPaidInvoice]![FilterListBox]
if "FilterListBox" = 1 the query for "lstCustomer" returns the correct records
if "FilterListBox" = 2 the query for "lstCustomer" returns the correct records
But if "FilterListBox" = 1 or 2, no records are returned.
View 9 Replies
View Related
Jul 13, 2014
I have a form (Suppliers) with a button that opens another form (Product List).
At the moment the form (Product List) is set as a pop-up form and when opened lists all products.
I want to filter the pop-up form to only display products for the current supplier displayed in the Supplier Form.
I have tried the following below without success - I have varied this but the filter does not apply ...
Private Sub Form_Load()
DoCmd.OpenForm "Product List", acNormal, , "SupplierID = " & SupplierID
End Sub
View 3 Replies
View Related
Apr 30, 2014
I have a button that opens a second form and filters that form based on a text box on the first form(which remains open). the problem is that it does not filter the second form unless the second form is already loaded for some reason.
For example if i click on the button it opens the form Unfiltered then i go back to the previous form without closing the first form, click the button again and it is then filtered .
I attached the screen shot of the macro for the button and there are no other events on the second form.
View 5 Replies
View Related
Jun 16, 2015
I have a form that has two different option button frames and 1 text box that I would like my users to be able to use to search/filter for specific records. I chose a form because a table does not work as a user-friendly interface for the data that is being stored. The first option button frame allows the user to filter by Month and is named [FilterDate].The second option button frame allows the user to filter by incomplete and complete records and is named [FilterOption].
The text box is used as a search box and is named [txtsearch].I am able to successfully create macros to apply filters for each of the above options; however, each time one of the options is updated, it removes the previous filter. What I need is creating a macro (preferrably) or vba code (if macro is not possible) so that my users can first pick a month (as this will always be the first thing they do when opening the form), then pick complete or incomplete records within that month if desired. The search box then would only filter records that meet the first two criteria (month and complete/ incomplete).
View 5 Replies
View Related
Oct 28, 2014
Is it possible to capture a form's filter? In Access 2013, I have a form (from a template database) listing contact information. I can set filters by clicking on the column headers and selecting which records I want displayed. There is also a button to run a mail merge with Word. I want the merge to only include those records displayed on the form at the time it's run.
View 1 Replies
View Related
Jul 25, 2013
I stumbled upon the Option Group function just yesterday and, happy as a clam, I created a group with 2 options in radio button style. I assigned the values to a field called Registration_Type as the 2 options are "Confirmed Registrants" and "Prospective Attendees".
[Great. That part works well. When I look at the table, a 1 or a 2 is in that field so it's great to know how to control accidental ticking of radio buttons (previous 450 records or so didn't have this option group functionality so one might easily tick one of the buttons. So one part of controlling option group I know I can handle via the table itself for now.]
The challenge is how to ensure the user always ticks one or the other ... I went back to the main table and tested the 'required entry' option for the Registration_Type field but forcing an action like this is not ideal in my mind. The usual error message vagueness for the average user is no good and I don't want to limit the user so much.
Is there a way to simply have a popup come up warning that neither radio button was ticked? Perhaps something linked to the form - i.e., maybe "after update"?? I only learned about attaching code to before and after update on controls a couple of days ago, so not sure if this would be best approach.
Just something to let the user know that nothing has been ticked in the option group as that controls in which of 2 reports the data will show up in so any record not ticked might mean a registrant being left out, which would be rather disastrous <g>.
View 1 Replies
View Related
May 13, 2013
Been trying to use wildcards in fields while Filter By Form instanced in Access 2007.
LIKE, BETWEEN, IN or */% not available?
The form is based on a query. I am guessing this is why the drop downs only show IS NULL or IS NOT NULL as choices instead of the entire unique list existing in the underlying table/query.
View 2 Replies
View Related
Jul 23, 2014
I have a form with a bottom that has a macro that uses applyfilter to filter the current form based on what is within a textbox located on the form.
I used the macobuilder and have my where condition as
[num] Like "*" & [Forms]![frm_Main]![Text181] & "*" Or [name] Like "*" & [Forms]![frm_Main]![Text181] & "*"
This works when I open the form by itself but when I try adding the form to a navigation form I get prompted to put in "num" and "[Forms]![frm_Main]![Text181] " etc. when I click the bottom.
View 5 Replies
View Related
Mar 12, 2014
I want to open a filter form with mulitple conditions.one of them is a date condition.
I'm using access 2013 and the code below:
Code:
DoCmd.OpenForm "Edit_Mission", acNormal, , "[Report_Date]= " & Me.Date & " And [Supporter_Name]='" & Me.Supporter & "'"
it's opens the form but with no data. I also tried the # and it's still didn't work.
View 1 Replies
View Related
Feb 9, 2014
I have a continuous Form named frmBirthdays that lists People with a [DateOfBirth] field.
In the Form Header I have 2 Unbound Combo Boxes 1- cboMonthFilter which list the 12 Months of the year in Text NOT Number and 2- CboAgeFilter that has a list of Ages 0 -30 (which is all i require) and a Clear Filter Command Button.
I would like to be able to filter the people list by cboMonthFilter for anyone that has a Birthday in any given month.
OR
I would also like to filter the people in the list by their age.
But never both at the same time.
View 8 Replies
View Related
Jun 27, 2013
All using 2010. I need to filter a subform from the main form.
Code:
sfrmMedCInfo.Form.Filter = "[SSNum]= '" & cboSSN & "'"
sfrmMedCInfo.Form.FilterOn = True
It's throwing an error: Variable not defined pointing to sfmMedCInfo. why do I need to declare the subform and how?
View 3 Replies
View Related
Aug 21, 2013
I have a reservation form and I want to tick a checkbox that will filter the form based on what is in the "Reservation Status" combo box.When the checkbox is ticked, the code would remove all records that have "Complete" as a status in the "Reservation Status" combo box. The non-working code that I currently have is:
Code:
Private Sub chkHideComplete_AfterUpdate()
On Error Resume Next
If Me.chkHideComplete = True Then
Me.filter = "[ReservationStatus] = 1"
Me.FilterOn = True
[code]....
View 7 Replies
View Related
May 16, 2013
combo boxes and continuous forms.I have a continuous form (works great), with two combo boxes that navigate (rather than limit/ filter the list) to the desired selection.One for suburb and one for postcode.
I have expanded the select criteria for the suburb to include postcode as some suburb names are used in more than one state. (I do not want to have to select a state, then suburb).I changed the column count to see the postcode next to the suburb, however when the selection is made only the first instance is selected.
Example.
Epping 2121
Epping 3076
If I chose Epping 3076, Epping 2121 is selected and the continuous form navigates to that suburb (rather than the one with 3076).Can I change this so that I can still search by postcode, or search by suburb and have the form navigate to the corrected suburb postcode combination?
View 5 Replies
View Related
Mar 13, 2015
I have a database with a filter on the form which users can apply I know at the bottom of the form it highlights it as filtered but I want something a bit more prominent displayed on the form when a filter is active.
View 5 Replies
View Related
Sep 11, 2013
I have a table fed form that will not accept editing to the filter statement.
Currently the filter is [Dealer Name]='ABC Company'
This is causing a problem because we have multiple locations with the same Dealer Name. They do however, have different Primary Account numbers.
I thought to edit the filter to [Primary Account]=102
However, after I save everything and go back to form view, the filter reverts to the original.
View 7 Replies
View Related
Jul 29, 2015
I have a continuous Form [Letter Log - All] with "LetterNo" field as the primary key. What i want to do is click the "LetterNo" and a filtered pop up form with subform should appear based on what has been clicked. But i don't have luck doing that. The name of the main form is "LetterLog" and its subform control name is "LetterLogSub"
here is what i did.
Code:
Private Sub LetterNo_Click()
'DoCmd.OpenForm "LetterLogSub", acNormal, , "LetterNo = " & Me.LetterNo, acFormEdit, acDialog <-- this one works but without the subform
'DoCmd.OpenForm "LetterLog", acNormal, , "Forms!LetterLog!LeteterLogSub.Form.LetterNo = " & Me.LetterNo, acFormEdit, acDialog
'DoCmd.OpenForm "LetterLog", acNormal, "LetterNo", "me.LetterLogSub.Form!LetterNo = " & Me.LetterNo, acFormReadOnly, acDialog
DoCmd.OpenForm "LetterLog", acNormal, "LetterNoFilter", "Forms!LetterLog!LetterLogSub.form!LetterNo = " & Me.LetterNo, acFormEdit, acDialog
End Sub
View 7 Replies
View Related
Jul 22, 2013
Every Page has its on data source based on query, and they aren't related to Parent form or to each other. I want to set few buttons on every Page which would filter records in predefined way.Ex: one page has calculated field named [Za platiti]. It has numeric values form 0 up. I want to set one button to filter only records where field [Za platiti] is greater then 0, and other butt to filter only records where [Za platiti] is = 0. Other filters based on combo box I use regularly.
View 6 Replies
View Related
Mar 16, 2015
I have a filter on a form : There is a text box (txtSearchP) where the user will enter their search term then click button to apply the filter:
Private Sub cmdSearchP_Click()
' Filter by Programme Description
Me.Filter = [Programme_Desc] Like "*" & Me.txtSearchP & "*"
Me.FilterOn = True
Me.Requery
End Sub
This works fine but actually I want to search two fields for the text entered in txtSearchP [Programme_Desc] OR [Programme]
I've tried this but it doesn't work:
Private Sub cmdSearchP_Click()
' Filter by Programme Code and Description
Me.Filter = [Programme_Desc] Like "*" & Me.txtSearchP & "*" OR [Programme] Like "*" & Me.txtSearchP & "*"
Me.FilterOn = True
Me.Requery
End Sub
I know I could give the users two text boxes and two Buttons one for each and this would work but I don't want the form to be cluttered.
View 4 Replies
View Related
Jun 24, 2013
i have one form filtered based on a field value, now i want to open another form which has only the same member ID but not the actual field on what the first form had been filtered (so i cannot just use the same filter) , so what i want to do is that the 2nd form should only show the members which are in the first form.
View 3 Replies
View Related