Trouble With Filters

Jul 6, 2006

I have been using the forums for the past month and a half, and they have been extremely beneficial to me. I am working on a database that cross references my companies Steel standards to American standards. I am trying to make it searchable in a couple of different ways. I have borrowed code found on this site to make two different search engines. One works very well but the other I am getting hung up when I try to switch from the previous code to mine. below is an example of my code. It is taken from code placed on here previous called "SampleSearch"

Private Sub cmdSearch_Click()
On Error Resume Next

Dim sSql As String
Dim sCriteria As String
sCriteria = "WHERE 1=1 "

'tblSubject qrySearchCriteriaSub
If Me![Spec] <> "" Then
sCriteria = sCriteria & " AND qrySearchCriteriaSub.Spec = """ & [Spec] & """"
End If

If Me![SteelType] <> "" Then
sCriteria = sCriteria & " AND qrySearchCriteriaSub.SteelType like """ & [SteelType] & "*"""
End If

If Me![Group11] <> "" Then
sCriteria = sCriteria & " AND qrySearchCriteriaSub.Group11 like """ & [Group11] & "*"""
End If

If Me![Group143] <> "" Then
sCriteria = sCriteria & " AND qrySearchCriteriaSub.Group143 like """ & [Group143] & "*"""
End If

If Me![Substitute1, Substitute2, Substitute3, Substitute4, Substitute5, Substitute6, Substitute7, Substitute8, Substitute9] <> "" Then
sCriteria = sCriteria & " AND qrySearchCriteriaSub.Substitute1 = """ & [Substitute1] & """"
End If

sSql = "SELECT DISTINCT [Spec], [SteelType],[Group11],[Group143]from qrySearchCriteriaSub " & sCriteria
Forms![frmSearchCriteriaMain]![frmSearchCriteriaSub].Form.RecordSource = sSql
Forms![frmSearchCriteriaMain]![frmSearchCriteriaSub].Form.Requery
'[Spec], [SteelType],[Group11],[Group143]

'frmSearchCriteriaSub.Requery
End Sub

I apologize also because I do not know how to post this in a scrollable window. If someone could help me with that too.

The problem with the code is that I am using a form to filter a query, this will then display the table of the steels that meet the requirements. However, I have altered all of the fields to my names and the combo boxes have my information, but they do not seem to place any parameters on the query. I attached the original DB that I got this code from any help would be appreciated.


Riley

View Replies


ADVERTISEMENT

Filters

Oct 24, 2005

I have a function button set up to filter my data, if I push the F8 button the filter displays and then enter my filter critera and push F9 this then displays my filtered search results. Once I am finnished with my results I would like to clear the filter so it does not appear in the field again. Once i close my form, or program the filter should be clear and then when I re-push f8 there should be nothing on the filter page. Is this possible?? How can I do this? Thanks

View 2 Replies View Related

Query Filters

Dec 8, 2005

If you view Query properties in design mode you will see a "Filter" property. When I put a WHERE statement in this section and click the "Apply Filter" button it works exactly as I anticipated, filtering out the records I want.

Does anyone know the syntax to change this property in VBA? Specifically, I want to add a command button to my reports switchboard that will apply a filter to a query.

Thanks in advance!

View 5 Replies View Related

Charts With Filters From A Form

Nov 13, 2007

thought this might have been easy, but no....

i want to have a form with a [DateFrom] and [DateTo] text box

you click a button, it goes to a chart and the chart is filtered between those dates (the chart has week along the x axis)

problem is, the recordsource of a chart in a report is a crosstab query and you can't put form filters into a cross tab query

have tried to ram the parameters in before opening it with


CurrentDb.QueryDefs("qry_Reporting_Charts").Parameters("DateFrom").Value = [txtFrom]
CurrentDb.QueryDefs("qry_Reporting_Charts").Parameters("DateFrom").Value = [txtTo]
DoCmd.OpenReport [cmbReports].Value, acViewPreview


but it looks like the parameters are read only or something :confused:

any ideas anyone?

thanx in advance

View 2 Replies View Related

Expression - Extra Filters

Aug 31, 2006

Is it possible to adde extra filters to an expression, i.e. the same as an AND clause in a SQL query.
For example,
=DSum("[1To90]","tableA","ID=2")

I need something like :
=DSum("[1To90]","tableA","ID=2 AND Region='A'")

Will that work ?

View 1 Replies View Related

Command Buttons And Filters

Sep 27, 2006

Hi...total newbie here trying to get out of the blocks!

I want to be able to open forms with a button and filter in the process.

I have Customer details in a table
I have Site details in a table
I have Product details in a table

From my 'frmCustomer' I want to hit a comand button to open 'frmSite' and filter only the records related to that customer, then from my 'frmSites' hit a command button to open 'frmProducts' filterd by that site.

Please help, driving me mad!

View 4 Replies View Related

Printing Filters In A Form

Oct 25, 2006

Having trouble printing after I performed a filter. Have a subform with continuous forms that I put various filters on..., however when printing, all the records print and not just what was filtered...Is there a way around this. Basically, I would like to be able to print out only the filtered records in my form view.

Max

View 7 Replies View Related

Handling Filters In A Form

Oct 19, 2006

hi

The database XXXXX_20061018.mdb contains the form Frm_XXXXXX.
Currently this form does not show data after it has been opened.
infact of the Me.FilterOn = False.
so please give me some idea how to solve this problem

thanking you

View 6 Replies View Related

General :: Filters On A Table Only Or Not?

Mar 21, 2014

I've been asked to try to propagate a filter result on all the tables on a database. Hence I'm trying to know if the action of a filter works on a single table only, or if it can work on more than one.

View 7 Replies View Related

Forms :: Subform With Filters

Apr 5, 2014

I have set up 2 tables, and got the tables linked with a foreign key. These tables store street names and house numbers.Ideally I would like to enter a street name, and then number from and number to, ie: Main Street, from 1 to 30.Each house number will has 4 fields associated to it.

The desired result in a form will be to enter the street name, numbers from and to, and then a sub form open up showing a list of numbers covering the range entered with 4 "Yes/No" fields next to each house number.Some streets could go up to as most as 300 houses, but I would not want that number shown for every street when it is not necessary. only the relevant number according to what is entered.All data would need to be stored and then queries and reports run against it.I am using access 2007 on windows 7.

View 9 Replies View Related

Defining Query Filters From A Form

Nov 28, 2005

I have a database about when computers have been installed

I have a form
It has a drop down list with Januray through to December

I want the user to select a month and a year and then click the command button and it will run a query displaying all the computers installed in the month of that year

any ideas people?

View 4 Replies View Related

Help To Develop Drop Down Filters In Access

Oct 26, 2005

hi,
Can anybody help me to create Auto filters as in Excel in Access Database ?
i dont have any knowledge of programming !
thanks,

View 2 Replies View Related

Modules & VBA :: Export To Excel With Filters

Aug 30, 2014

I'm trying to create a button that will export the filtered records on the screen to an Excel file.

I'm using strWhere as my where string and found this code in one of the posts from this forum, but unfortunately, I can't get it output only the filtered records. It outputs all records instead.

Dim db As dao.Database, qdf As QueryDef, mySQL As String
Dim strWHERE As String
Const strSQL = "SELECT * FROM [Action Register] "

[Code].....

View 11 Replies View Related

Forms :: Creating Different Filters For Scrolling?

Apr 3, 2015

The last two weeks I taught myself Access (and hurt quite a few braincells in the process) Yet I am getting close to what I want to achieve, but now I am stuck how to proceed with the following:

I want to have 'forms' view as my main interface for my records. This is working very nicely, and I like how I can scroll fast through all records with my mouse-wheel. I also need to be able to filter records that will be displayed and scrolled through this way, and I created a filter which I can now toggle on or off easily for this purpose.

But now my challenge is, I want to be able to quickly select different filters, so for example, show only forms with a certain date field content. Or filter only forms which have a certain check-box checked. Etc. etc. And later on probably a bit more advanced, like: display forms that both contain 'this' and 'that'.

But I can't find a way to create several different and selectable filters? So this should probably be achieved in quite a different manner?

View 13 Replies View Related

Modules & VBA :: Date Filters Using Combo Box

Mar 21, 2015

I have a set of combo filters that filter one after the other as follows –

Code:
Private Sub cboCity_AfterUpdate()
If Nz(Me.cboCity.Text) = "" Then
Me.Form.Filter = ""
Me.FilterOn = False

[code]...

and so on to filter down so the user can work with what they filter, my question is how can I add on a filter that filters between dates? and second I was hoping that I could program the filters so that they could be changed individually/randomly as to filtering one after the other and then clearing to restart the filtering again if that makes sense. I have tried using this, but it doesn’t work ‘Bad Command’

Code:
Me.Form.Filter=”StartDate =#” & Format(Me.txtStartDate, “mm/dd/yyyy”) & “#”

And

Code:
Me.Form.Filter=”EndDate =#” & Format(Me.txtEndDate, “mm/dd/yyyy”) & “#”

View 4 Replies View Related

Queries :: Run Multiple Filters And Criteria

Jun 20, 2014

I have a table that I would like to run multiple filters and criteria.

I would like to have the user enter a word that matches a specific word that matches a field name and all the data fields = 1.

i.e user inputs word baa baa and the query criteria is set to one, it will output all the surveys that match that.

View 14 Replies View Related

Forms :: Filters Are Not Remembered Between Loads

Apr 19, 2015

I have a search form which suddenly stopped remembering filters between loads. I managed to accidentally replicate the behaviour on a second database where I knew the filters worked - in this case the code was

Code:
Private Sub Form_Unload(Cancel As Integer)
Me.Filter = "(False)"
Me.FilterOn = True
End Sub

Turns out that simply commenting out then uncommenting this section (while the form was open) was enough to break it. Filtering still works, but the form's filter property is forgotten when it unloads, and the only way to change it permanently is in Design View.

So I made a very simple test db with a filtered form, started faffing around with the code while it was open, and lo and behold the filters have stopped working. But I've compared the functional and non-functional versions and I can't for the life of me see what's been changed. I suspect I've run into some kind of bug (not that I should be fiddling with code while in form view anyway) but what can I do to revert it?

It turns out that I can force the filter to be saved by hitting Ctrl+S before I exit the form. Still no clue as to why v1 mysteriously works and v2 mysteriously doesn't. In the meantime, can I replicate Ctrl+S in VBA? I tried DoCmd.Save acForm "FormName", but no luck there.

View 1 Replies View Related

Modules & VBA :: How To Enable Multiple Filters

Apr 17, 2015

I have a form where I have buttons that apply filter to a certain column.How do I enable multiple filters where I can click more than 1 filter button and it keeps the filters?

First filter button:

Private Sub Command1_Click()
DoCmd.ApplyFilter "Filter1", "[MyQuery]![Checkbox1]=Yes", ""
End Sub

Second filter button:

Private Sub Command2_Click()
DoCmd.ApplyFilter "Filter2", "[MyQuery]![Checkbox2]=Yes", ""
End Sub

Third filter button:

Private Sub Command3_Click()
DoCmd.ApplyFilter "Filter3", "[MyQuery]![Checkbox3]=Yes", ""
End Sub

It works well, but one by one. How can each next filter be added to previous filters by clicking filter button on a form?

View 2 Replies View Related

Modules & VBA :: Combo Filters That Filter One After The Other

Mar 12, 2015

I have a set of combo filters that filter one after the other as follows -

If Not IsNull(Me.NameFilterBox) Then
If Me.Form.Filter="" Then
Me.Form.Filter="Name ='" & Me.NameFilterBox & "'"
Else
Me.Form.Filter = Me.Form.Filter & " and Name = '" & Me.NameFilterBox & "'"

[Code] .....

and the I use the

Me!Form.Filter = Me!Form.Filter & " and Name = '" & Me!cboOPOwner.Text & "'"

to filter down so the user can work with what they filter, my question is how can I add on a filter that filters between dates? and second I was hoping that I could program the filters so that they could be changed individually/randomly as to filtering one after the other and then clearing to restart the filtering again ...

View 11 Replies View Related

Creating Filters In Forms Using Parameters

Jan 29, 2013

I am creating a front end of a database that is the forms only version with ext. .accdr...I would like to create a way that each user of the front end can apply a filter using parameters, allowing the user to enter in their name when opening the front end.Form and Table name is "Non-Student Tasks Completed Daily" and "Student Connection Task" Field name is "SSC"..How can I get a box to appear when someone opens the database that askes them to enter their name to apply the filter?

View 4 Replies View Related

Reports :: Have A Form To Generate Report With 3 Filters

Aug 12, 2014

i have a form to generate report with 3 filters,

1.sales_person,
2.Client_Name,
3.Product_ID

these are combo selection and the report is working fine with these 3 filters. filtering by a query. all 3 feilds on the same table.what i am unable to do is make these filters as option to select with a check box. like if i dont want the third filter product but to generate report with the other two filters sales_person and client_name.

edt: uploading my DB Form report_generator on medical_request_query and table medical_requeset

View 6 Replies View Related

Modules & VBA :: Filters Not Working For Multiple Users

Mar 9, 2014

I have created a module, where based on various selections (form), the output is thrown in the table for editing various fields. This works fine with single user. But once I have placed the same database on the share drive for multiple users, the users are unable see the data in the text filters. I don't know what is the issue all about. Also if i use me.requery, the text filters becomes blank. Below is the code :

Code:
Option Compare Database
Option Explicit
Public Function SelRec(shDate As Date, ATMID As String, City As String, Depots As String, Vendor As String) As Boolean
SelRec = False

[Code] .....

View 12 Replies View Related

Reports :: Multiple Filters In Access Report Using Vba

Jul 28, 2015

I am trying to link 2 reports so that when a user selects a field in the 1st report it will only return records specific to the filters. I have used the following code via a field in a report to return records in a seperarte report using 1 filter "BudgetPool". What I need to do is add a second filter "ContratorType" to the code to allow the second report to refine the records.

Private Sub BudgetPool_Click()
DoCmd.OpenReport "Budget Expenditure by Pool per Project Type", acViewReport, , "BudgetPool=" & Me.BudgetPool
End Sub

View 3 Replies View Related

Making Yes / No Fields Execute Different Filters Or Functions

Jun 27, 2013

I have a form named frmBuilds_All. This is a continuous form and has 4 yes/no fields. They are "WaitingFab", "WaitingPaint", "WaitingParts", and "Completed". The labels however are just "Fab", "Paint", "Parts", and "Completed". I would like to make it so that when one of these check boxes are checked, the label for that box has it's background color change.

Filter From List

On a separate form named fromBuilds_Today, a list of all builds for today are displayed. I would like to make it so that when the check box for "Completed" is checked, the record in question is filtered off of this list.

View 3 Replies View Related

Combining Multiple Toggle Button Filters

Sep 17, 2013

I have a form that I use to filter a sub-form. In the form I have 4 toggle buttons that filter the corresponding fields in the sub-form quite well. What I would like to have is when one toggle is selected, the user can select a second or third toggle to further refine their inquiry. I am attaching the code that I used for the individual filters.

Code:

Private Sub Toggle_Filter_DOB_Click()
If Me.Toggle_Filter_DOB = True Then
[Forms]![Phase 2]![FormPhase2_sub].Form.Filter = "DOB = #" & Me.ATS_DOB & "#"
[Forms]![Phase 2]![FormPhase2_sub].Form.FilterOn = True
Me.Toggle_Filter_DOB.Caption = "Filter On"

[Code] ......

View 4 Replies View Related

COMBO Box Selection Filters Out A List Of Contacts?

Jun 30, 2015

I'm trying to set up my own form for my customer contacts.

I have TABLE A that lists general customer information.

I have TABLE B that lists customer branches (each customer has multiple branches).

I have a combo list set up so that if I select a customer name, the rest of the form populates with the customer general information.

Is there any way I can filter out a list depending on what customer is selected?

I only want to see the branches of the customer I've selected on the COMBO box.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved