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
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.
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
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.
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.
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.
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
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.
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.
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
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] "
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?
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’
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.
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?
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 ...
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?
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
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
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
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.
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"