Modules & VBA :: Filter By Form With Multiple Options

Jul 23, 2014

I am using Select Case to filter a form on open and it works fine when I have this:

Code:

Case Is = 2
Forms![Open Opportunities List].Form.Filter = "[Employee] = 4"
Forms![Open Opportunities List].Form.FilterOn = True

But if I want the form to open filtering multiple employee records, like this:

Code:
Case Is = 6
Forms![Open Opportunities List].Form.Filter = "[Employee] = 2 & " And 9 & " And 10 & " And 11
Forms![Open Opportunities List].Form.FilterOn = True

I get a type mismatch error and I am stumped as to why and how to overcome.

View Replies


ADVERTISEMENT

Modules & VBA :: Text Field In A Form Updated Multiple Times When Filter Is Applied?

Sep 9, 2013

In my Access 2010 database there is a form with a large number of checkboxes enabling me to select/deselect certain record details.

Each click on one of the checkboxes triggers a VBA routine setting true/false values in one of several tables linked to the main table.

A query over all records is filtered by the true/false values of the linked tables and the resulting set of records is displayed in the (continuous) form.

The header of the form contains a text field with the value "=GetRecCount()" displaying (correctly, but randomly fast) the number of records selected:

Code:
Function GetRecCount() As String
Dim NumRecs As Long
Dim rs As Object
On Error Resume Next
Set rs = Forms![Super Search].RecordsetClone
rs.MoveLast
NumRecs = rs.RecordCount
Set rs = Nothing
GetRecCount = Format(NumRecs, "##,###")
End Function

Now, the funny thing is that each click on one of the boxes results in 1 call of the VBA routine setting table values, but 21 calls (!) of the text field "=GetRecCount()" in the form. I have established this by incrementing a public variable at each pass.

Why a field in a form is updated 21 times when a filter is applied?

View 4 Replies View Related

Filter Query Combobox Options

May 11, 2015

I created a form that has about 8 different filter options that can be used to filter a query. I used the filter by form table to set it all up and I can get each of them to work individually as well as 2 work together... but as soon as I added the information for the 3rd, I stopped getting results... in fact nothing happens. Even with the code for all 3 and selecting just 1 option, nothing happens any more. I have

cbopersonnel that is supposed to look up values in 4 different personnel columns
cboshift that looks up all shift work
cboworkdef that looks up what the job was (just a title)

Having just 2 in the filter by form works great, but adding 3 screws everything up. And I'm not talking about selecting all three (I know that would limit the output more) but I mean, with all 3 setup and selecting shift as "nights"... nothing gets filtered anymore. I have cbopersonnel on "look for" tab and everything else is on the next "or" tab. I tried to set it up on individual tabs but access combined it. I also tried adding cboshift to the "or" tab with everything else and access sent it back to "look for". All of the cbo references are under their respective search area... so in the table, the shift column has the cboshift lookup value. Is it just because I'm not using quotes around the cbo output? That doesn't make sense to me though. Anyway below is the lookup value for the cboshift.

[Forms]![Log Book Lookup]![cboshift]

View 2 Replies View Related

Possible To Color Certain Entries? Exclude Filter? Print Options?

Jul 12, 2005

OK, Im new to access, and have a database of 210,000 people.

I have to fit a lot of data printing sideways. Also in a certain format...

First thing...

There is a field that may contain RKS with other info or RKS alone. These must all be red along with the addresses, but thats it. But when I change the font color it changes the whole database. Thats it.

Other thing... I want to do a sort of exclude filter? We need to do some printing... again with the rsk, but we want to exclude anything that has rks in a specific field.

The last thing is print options/page setup...

I want to condense it as much as possible from left to right so al the needed information can be printed.

Here is how we want it printed...

__________________________________________________ ______________
Street here, house # | then other information in approated columns here
customer #, name here |
--------------------------------------------------------------------------

the problem is, street address, house number, customer number, first and last name are all in different columns.

is there anyway i can print it this way?

also the column names need to be extended downwards? some of the names are too long

like |This is column a| but we want

|this is |
|column a|

so it isnt as wide. and I can fit more columns on the page.

Thanks a lot for your help, I only have 2 hours to get this.

Martin Seidl

Oh yeah, if it helps, Im stuck with access in german :(

View 7 Replies View Related

Forms :: Cascading Combobox To Filter Options That Can Be Entered Into Second Combo Box

Jul 31, 2014

I'm trying to use a cascading combo box to filter the options that can be entered into a second combo box.

In frmBabies, a Mode of Delivery is selected from 8 options. 4 of these are "normal" deliveries and 4 are caesarean sections.

A second combo box selects the Indication for Operative Delivery. The table tblIndOpDel contains options for normal as well as caesareans. I would like to filter the indications so that the user cannot enter an indication for normal delivery for a caesarean section.

Both tblIndOpDel and tblDelMode have a foreign key to tblDelModeCat, which categories deliveries as normal or caesarean.

I'm stuck on how to proceed from here. Sample database attached.

View 2 Replies View Related

Modules & VBA :: Multiple Combo Box IF THEN To Filter On NULL

Sep 12, 2013

I have a main form with multiple combo boxes that filter a subform datasheet. In my main form combo box [PR_Filter] I added a selection titled "<Blanks>". When I select "<Blanks>", I want it to filter my subform field [PR] for NULL values. If I select anything else I want it to filter on that selection. I cannot get the NULL filter to work.

Here is the code that I have (Red is the field I need the NULL values):

Private Function PurchaseFilter()
Dim strFilter As String
Dim bFilter As Boolean
bFilter = False
strFilter = ""

[Code] ....

View 14 Replies View Related

Modules & VBA :: Filter Table And Export To Multiple Excel Workbooks

Nov 21, 2013

I have a table (tblMaster). In the table is a field called Agency. The table is 200,000+ records and there are around 35 Agencies. The table grows monthly, with potentially new Agencies added all the time.

What I have been asked to do is to have a button on a Form which, when clicked, exports to Excel a separate workbook with all the table data for each Agency in the table.

I have suggested a combo-box on the Form that passes the Agency name to a query and then exports (so they could have control of which Agency to export) but no - they just want one click, spool through the table and create the 35 (or so) exports.

View 4 Replies View Related

Modules & VBA :: Errors With Custom Filter - Data Full Of Records With Multiple Columns

Sep 11, 2013

Custom filter I'm trying to set up. I have a data full of records with multiple columns and a form linked up to it. The form has a search box that works as well as navigation buttons.

Currently I am trying to get a filter to work. The filter will use up to five combo foxes to narrow down the fields, then return the filtered records after clicking a button. The button itself is where my code is. My issue now though is I cannot get the filter to work if I try to use more than one combo box.

The code I have at the moment is as follows:
'------------------------------------------------------------
' cmdApplyFilter_Click
'
'------------------------------------------------------------
Private Sub cmdApplyFilter_Click()

Me.Filter = "[Asset Group] = " & Me.cmbFilter1 & "" And "[Location] = " & Me.cmbFilter4 & ""
Me.FilterOn = True

End SubThe current error I am getting is Error 13: Type mismatch. I also know that the And might be the cause but I cannot change it to AND: it keeps changing back.

View 9 Replies View Related

Using Multiple Search Options

May 14, 2006

Hi guys,

I made a form to search some values in a table and print them in a report.
The form looks like this:
http://www.minezone.nl/jamie/search.bmp

When clicking the "show report" button a macro is executed. In this macro I have the following code:

OpenReport -->
Report name: main
View: print preview
Where condition: [name]=[Forms]![searchfeedback]![namebox] And [week]=[Forms]![searchfeedback]![week]

Now what I want is a bit difficult.
I want to give users the ability to search by each option and by using multiple options.
i.e.
- When filling in the name and click the show button it gives all reports for that person.
- When filling in the name and selecting the weeknumber it gives all reports for that person in a particular week.

and so on with the id field, the date field and the supervisor field.

How do I create something like that?

View 3 Replies View Related

Forms :: Multiple Filter Form

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

Multiple Options To Find Criteria

Jan 19, 2006

I'm building a database with supplier information. Some users prefer to use the supplier names, but it is sometimes hard know how foreign suppliers are spelled, therefore some users prefer to use supplier numbers.

I want my form to show all supplier data based on either the supplier number or the supplier name, which can both be chosen from 2 comboboxes.

In addition, and here's the catch, I would also like the two comboboxes to update eachother. So if I choose supplier 2 in the first box, the other box should automatically show me the name of vendor 2 and vice versa.

I think the example form shows my problem best ..

View 4 Replies View Related

Forms :: Filter Form With Multiple Conditions?

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

Tables :: Autofill Fields - Multiple Options

Nov 6, 2012

I am creating an access database for my employer which handles blood donating at different venues. I have come unstuck with a particular request.

They would like to create 3 autofill fields for "dates", which are dependent on the previous field "Venues"

There are different venues, which are visited 3/4 times per year. This data is stored in a separate "Venues" table.

On the main user form, they would like to see the dates available to donate, when the Venue field is selected (this is an autofill box, from the Venue table). So if the London venue is visited on 1/1/13, 2/2/13 and 4/4/13. When the user types London into the "Venue" field then the next 3 cells auto fill with 1/1/13, 2/2/13 and 4/4/13.

View 6 Replies View Related

Using Access To Create Document From Multiple Choice Options

Mar 23, 2013

I currently write (very long) reports for work, which have a lot of standard text in them - but the standard text varies according to the client's history.

I want to create a report-writing application for myself, composed of series of yes/no/maybe buttons
and depending on whether I click yes/no/maybe in each section, a different segment of text is inserted into the report.

Ideally the application would be able to insert, or create, formatted text - such as headings, bullet point lists etc - I would need to be able to export this report into Word

I started out by making a table, with each section being a different field, and the various paragraph options as different cells in the field, but I am stuck at present on the basic functionality of "click button , insert text"...

View 3 Replies View Related

Forms :: Search / Filter By Multiple (optional) Textboxes On Form

Aug 1, 2013

I'm relatively new to MS Access (using MS Access 2013 but the db should work on 2010, too) and try to develop a database for an NGO I'm working in. I created almost all the tables (all that I need for now) and made the relationships.

However now I start to create forms and later reports for the actual user. The database will store information about clients and track consultations and assistance the NGO gives to them. There will be around 50.000 to 70.000 clients in the main table. Every client has a specific Individual ID and is member of a family which itself has another specific Group ID.

Now here is my problem: The User usually searches for the respective family by the Group ID. I implemented this with a search query using the ID number of a search text box. All done and no big problem.

But sometimes the ID number is not known so the user needs to search by name (First and Last Name). I use to different textboxes for this and it works in a similar way like the number search by query (Like "*" & [Forms]![frm_SearchIC]![txt_LName] & "*"). All still good However since most of the clients are actually from arabic speaking countries, converting the names into the Latin alphabet is bound to fail and produce a lot of misspellings. Therefore I added 2 more textboxes and 3 comboboxes for the user to give more information about the client and therefore make it easier to search for the person. I was able to produce a query which gives you the right result if you have ALL information at hand. However, this is not always the case.

1) But I cannot find a way to tell the query that if the a certain textbox or combobox is empty, it shall just "ignore" it and use the information at hand. I tried this in the query by adding in the criteria OR .... Is Null. This is alright for one or two textboxes but for the many I have, it seems to be too many different combinations for the criteria. It just worked with some fields but others always had to be filled in...

2) If no information is given at all, the database should inform the user that he needs to enter at least on field. If nothing is found the user should get a msgBox saying "No IC matches your criteria".

3) The results of the searches should be given out in another form where the user can pick the person from 1-to-many results.

I attached a sample database with sample data and reduced tables, fields, and entries ...

View 6 Replies View Related

Reports :: Filter Multiple Fields In A Report Using Comboboxes In A Form?

Jul 24, 2015

I have a report based on a query that I put inside a form. What I want to do is create 4 comboboxes from which users can choose options that will filter the report without leaving the form or opening the report in a separate window. Also, I want to make the filters dependent on each other, meaning if a select option A on combobox 1, the options i will select on combobox 2 will only be based on the earlier filter on combobox 1 ...

So far I'm able to do at least 2 of the comboboxes to filter the report, but they aren't based on which one was used to filter the report first. So if i filter the records by choosing option A on combobox 1, combobox 2 will still filter every record.

here's my 2 codes so far:

Private Sub cboLocation_AfterUpdate()
On Error GoTo Proc_Error
If IsNull(Me.cboLocation) Then
Me.qrySalesByLocation.Report.Filter = ""
Me.qrySalesByLocation.Report.FilterOn = False
Me.qrySalesByLocation.Report.Requery

[code]....

the other 2 comboboxes, I can't apply the same code cause the enter parameter dialog keeps popping out.

View 3 Replies View Related

Local Table And ODBC Linked Table Don't Have Same Filter Options

Dec 31, 2014

In a local DB table or a data grid view, the columns have an arrow at the top next to the name. When the arrow is clicked, all the entries in that column are displayed with check boxes. They are listed underneath the "sort" and "text filter" options. I am working on a DB project with ODBC linked tables instead of a local access table.

My linked table does not have this same functionality. It is missing the names with check boxes where I can select individual entries. I don't know the correct terminology for this functionality I am describing. That makes searching tough. What this is called and why the tables would be different.

View 3 Replies View Related

Forms :: Dynamic Filter With Multiple Possible Filter Criteria

Jan 26, 2015

I have a form that is showing data from 1 table. That table has 12 different fields on it and I want to be able to filter based on selections I make in a combo box in the header of the form. The filter string must be dynamic enough to allow filtering based on 1 criteria selected, or multiple criteria selected. For example:

If I have values in filter fields 3, 5, and 9 I'd want the filter string to be created as follows:

"...WHERE field3 = field3filter.value AND field5 = field5filter.value AND field9 = field9filter.value"

If I have values in only field 7, I'd want th efilter string to be created as follows:

"...WHERE field7 = field7filter.value"

And so on and so on.

I have created some filters before but all of the different VBA syntaxes I'm using seem to come up short.

View 5 Replies View Related

Modules & VBA :: Filter The Form Records With It?

Sep 12, 2014

vba code for filtering the records of the form made out of a table. The form contains combos that contain the lists of unique records in several colomns of the source tale. So i need to filter the records of the form using the combination of the values of that combos. But can't even apply a single filter using this code:

Me.Filter = "Business = " & list59.Value
Me.FilterOn = True

"Business" is the name of the column in the source table, and the "list59" is the name of the combo which contains the unique records of the "Business"

the code takes place as a button "apply" is pressed

View 4 Replies View Related

Modules & VBA :: List Box Form Filter?

Feb 12, 2014

I want to be able to show all records from tblRecords where, The [tblUser][PositionID] = The Value selected on the list box.The problem being I don't know how to do this with them all being on seperate tables and linked via relationships. I.e. [tblRecords] only holds the UserID, [tblUser] has the PositionID.

I also need this value to keep building towards my filter string, i.e. I can select this position ID and records from within the past 4 days.I've attached pics of the form and relationships.

Here is my current code:

Code:
Option Compare Database
Option Explicit
Private Sub cmdReset_Click()
'Purpose: Clear all the search boxes in the Form Header, and show all records again.
Dim ctl As Control

[code]....

View 6 Replies View Related

Modules & VBA :: Options For Calling A Subroutine

Jan 14, 2015

Imagine I have two subrountines:

Code:
Private Sub DoSomething1()
[Do Something]
End Sub

Private Sub DoSomething2()
[Do Something]
End Sub

And this Declaration:

Code:
Dim str As String
str = 1

Is it possible to refer to/call one of these subroutines using something like this:

Code:
("DoSomething" & str)

View 1 Replies View Related

Modules & VBA :: Filter Not Working In Navigation Form

Jul 20, 2014

I inherited this quote and trying to enhance it but having problem.

The filter in navigation form is not working but it is on its own form, the filter is working without problem.

View 5 Replies View Related

Modules & VBA :: Form Filter And Exclude With Check Box?

Aug 14, 2014

I have the following code which builds a filter on my form which i can then generate a report from.

However id like to add a check box to exclude rather than include a certain [Error_Type] which is "Wrong Batch" and im not sure how id do it..

the vba i have so far is as follows

Code:
Private Sub cmdFilterConvErrors_Click()
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "#mm/dd/yy#"
If Not IsNull(Me.txtqccheckby) Then
strWhere = strWhere & "([Error_QC_By] = """ & Me.txtqccheckby & """) AND "

[code].....

View 1 Replies View Related

Modules & VBA :: Applying Filter In Form With 2 Variables

Jun 6, 2013

I am fairly new to VBA and am trying to apply a filter within a form so that agent records can be filtered based on an agent's name (so that they can only see information that refers to them).

I also want a record to be removed when it has been completed (when this habbens a date completed field will populated) however I do want to see those completed records that refer to the agent that have been completed today.

Here is my code. The 2 filters work on their own howver when I put them together I get a mismatch error.

If Me.txtRole = "Agent" Then
DateCompletedFilter = "(DATECOMPLETED Is Null) Or (DATECOMPLETED = Date())"
AgentFilter = "CASEOWNER ='" & Me.txtName & "'"
DoCmd.ApplyFilter , AgentFilter And DateCompletedFilter
Exit Sub
End If

View 13 Replies View Related

Modules & VBA :: Using Combo Box To Filter Records From A Form?

Oct 1, 2014

I am using combo box to filter records from a form. The data source for the form is from a query.

I use the combo box within the query to filter the data, I would like the form to refresh/ run the query again every time a new selection is made from the combo box.

View 2 Replies View Related

Modules & VBA :: Setting Filter On A Form With Variables

Aug 26, 2014

I am trying to set a filter on a form with VBA using variables and having no success at all. The code I tried last, which seemed to be "close, but no cigar", was:

Code:
Dim sFilterValue As String
Me.FilterOn = False
sBiller = Me.txtbiller.Value
sLastSource = Me.txtbiller.ControlSource
sLastSource = "[" & sLastSource & "]"
sFilterValue = sLastSource & "=" & sBiller
Me.Filter = sFilterValue
Me.FilterOn = True

sLastSource and sBiller are global variables. When I debug this code the sFilterValue is exactly what I would plug in manually and the Me.Filter shows up as "[Field Name] = Filter Value". But it crashes on Me.Filter = sFilterValue. I have tried all sorts of combinations but nothing I've tried works. What is the proper syntax for using variables as filters?

View 2 Replies View Related







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