473,396 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

flexibility of selecting fields in filtering

97
Hi,

I need to create a filter form that gives a user flexibility in selection any fields in a table and in filtering records based on conditions, such as range. I've read some about a multi-select list box, but it does not give flexibility of choosing any fields. Can anybody help me on this and tell me what subject I should read? Many thanks in advance!

[I am using Access 2000 (Window XP) and ODBC connection to MySQL server table]
Feb 15 '08 #1
12 1508
sierra7
446 Expert 256MB
Hi
If you are using Access have you tried the "Filter By Form" technique.

I personaly don't like it because users can filter for anything..... then not understand the results, or not be able to revert to normal form, or call for support...

However, if used intelligently it allows you to filter on multiple fields, I think including ranges with the correct syntax, without coding!

S7
Feb 16 '08 #2
loisk
97
Hi
If you are using Access have you tried the "Filter By Form" technique.

I personaly don't like it because users can filter for anything..... then not understand the results, or not be able to revert to normal form, or call for support...

However, if used intelligently it allows you to filter on multiple fields, I think including ranges with the correct syntax, without coding!

S7
Thanks for you reply, Sierra7!
In order to revert to normal form have you tried to use "Remove Filter/Sort"?

Anyway, I will look into more as you suggested and will get back. Thanks again!
Feb 19 '08 #3
loisk
97
Thanks for you reply, Sierra7!
In order to revert to normal form have you tried to use "Remove Filter/Sort"?

Anyway, I will look into more as you suggested and will get back. Thanks again!
The problem is that I need to create a filter form that executing the select query with information entered by a user in 'WHERE' clause. That's what I meant 'flexibility'. For example,

SELECT a, b, c, d, FROM mydb WHERE xx = yy

xx and yy will be entered by a user. Can anybody help on how I should approach? Thanks!
Feb 19 '08 #4
sierra7
446 Expert 256MB
Hi
Yeh, 'I' have no problem removing the filter etc but the problem I have found with some users was that they did not realise their data had been filtered, then tried browsing for something else. Anyway, that's not your problem.

Sorry to be dim but I'm a bit confused about what you mean by a 'Filter Form'
Are you suggesting that the users will enter parameters in your form to ;-
  1. Display matching data in the current form ?
  2. Set criteria for opening another form or report ?
  3. Create an SQL string for some other purpose to use elsewhere?
Or to put to another way, when you execute your query where will the results display?

Should the users select a, b, c & d all the time or sometimes just a, b & c? (incidentally I would drop the last comma in your string or it won't work) and the WHERE can be also be on a, b, c or d ?

S7
Feb 20 '08 #5
loisk
97
Hi
Yeh, 'I' have no problem removing the filter etc but the problem I have found with some users was that they did not realise their data had been filtered, then tried browsing for something else. Anyway, that's not your problem.

Sorry to be dim but I'm a bit confused about what you mean by a 'Filter Form'
Are you suggesting that the users will enter parameters in your form to ;-
  1. Display matching data in the current form ?
  2. Set criteria for opening another form or report ?
  3. Create an SQL string for some other purpose to use elsewhere?
Or to put to another way, when you execute your query where will the results display?

Should the users select a, b, c & d all the time or sometimes just a, b & c? (incidentally I would drop the last comma in your string or it won't work) and the WHERE can be also be on a, b, c or d ?

S7
Hi, Sierra7!

Yes, the SELECT statement shoould be the same because that's what we want to filter, but WHERE should be any column heading in the table.

We want to see a, b, c, d all the time, where the condition is changed every time. In other words we want to filter a, b, c, d by other column heading, e.g., spanish=1 and county="LA", something like this, for data analyzing purpose.
The WHERE part has to be flexible that a user can select any column heading in the table as necessary. So my question falls into 1. Thanks!
Feb 20 '08 #6
sierra7
446 Expert 256MB
Hi again Loisk
From your last posting I have picked up;
  1. The WHERE can be any column heading in the table
  2. Display data in current form (I presume every field (column) is shown)
Thanks for clearing the confusion because some people refer to a Filter Form as a 'dialogue' form that sets conditions for opening a Report or another form.

What you seem to want to do is set a filter on the current form but because of the flexibility you say you need then I go back to my original suggestion of using 'Filter By Form'.

Incase we are crossing purposes again, this is initiated by clicking on the small icon with a filter-funnel and a square 'form' in the background. If you are using the default menus/toolbars it is the one beside the 'funnel with a lightning bolt' in the top menu, or can also be brought up by right clicking in the centre of the form.

Oh! It has just occurred to me that you might be using UNBOUND forms with MySQL, (in which case the Access Filter By Form will not work!) so I had better stop here until you let me know.

However, I will add this reference Example Filtering on a Form

I wait until you advise you are using Bound or Unbound forms

S7
Feb 21 '08 #7
loisk
97
Hi again Loisk
From your last posting I have picked up;
  1. The WHERE can be any column heading in the table
  2. Display data in current form (I presume every field (column) is shown)
Thanks for clearing the confusion because some people refer to a Filter Form as a 'dialogue' form that sets conditions for opening a Report or another form.

What you seem to want to do is set a filter on the current form but because of the flexibility you say you need then I go back to my original suggestion of using 'Filter By Form'.

Incase we are crossing purposes again, this is initiated by clicking on the small icon with a filter-funnel and a square 'form' in the background. If you are using the default menus/toolbars it is the one beside the 'funnel with a lightning bolt' in the top menu, or can also be brought up by right clicking in the centre of the form.

Oh! It has just occurred to me that you might be using UNBOUND forms with MySQL, (in which case the Access Filter By Form will not work!) so I had better stop here until you let me know.

However, I will add this reference Example Filtering on a Form

I wait until you advise you are using Bound or Unbound forms

S7
Hi,

I am using Bound form connected to MySQL table via ODBC.
Thank you so much, sierra7!
Feb 21 '08 #8
sierra7
446 Expert 256MB
Hi,

I am using Bound form connected to MySQL table via ODBC.
Thank you so much, sierra7!
That's good! The reason that I am banging on about Filter By Form is that you said you wanted flexibility; to filter on any field; to state ranges and I think you hinted about multi-select (By which I mean not just filter by "Florida" but "Florida and New Mexico")

And I believe you can do all this using Filter By Form withou writing a line of code!

You users will have to learn certain rules of syntax for > , < , BETWEEN, LIKE and IN etc

If you read the topic in Help it should be self explanatory but let's see if this is what you want first.

S7
Feb 21 '08 #9
loisk
97
That's good! The reason that I am banging on about Filter By Form is that you said you wanted flexibility; to filter on any field; to state ranges and I think you hinted about multi-select (By which I mean not just filter by "Florida" but "Florida and New Mexico")

And I believe you can do all this using Filter By Form withou writing a line of code!

You users will have to learn certain rules of syntax for > , < , BETWEEN, LIKE and IN etc

If you read the topic in Help it should be self explanatory but let's see if this is what you want first.

S7
Thanks for your prompt reply!
I did read about Multi-select listbox or so, but it's still not what I am looking for.
I need to be able to select not just by value in a column, but should be able to select any column heading at filtering. I am not sure how I put it in better way in explanation. Multi-select box is flexible in selecting multi values in a column. To reiterate, in WHERE clause, for instance, in where column=value this column should be chosen by a user at the time a user filters.
I hope I am not making you irritated by my being inefficient in describing the problem.
Feb 21 '08 #10
sierra7
446 Expert 256MB
That's exactly what Filter By Form allows!

You can filter by any or all fields! Even putting a range in the field (with the correct syntax)

You had better give more detailed examples because I can not see where we differ.

S7
Feb 22 '08 #11
loisk
97
That's exactly what Filter By Form allows!

You can filter by any or all fields! Even putting a range in the field (with the correct syntax)

You had better give more detailed examples because I can not see where we differ.

S7
Hi again!

Now I see what I was missing in describing my problem!
I know that the Filter By Form can do this, but the difference is that...
The displayed fields are only a few, like 4 or 5 columns out of more than 20, and selecting column will be any column in those 20 plus columns that are not shown in the form. Hope that I am making it clearer than before.
Feb 22 '08 #12
sierra7
446 Expert 256MB
That makes life difficult !

I think in this case you will need to create a new form with 20 or so unbound TextBoxes each representing one of your fields, then within these boxes you set up you criteria string and with a command button you open the form you have been referring to
Expand|Select|Wrap|Line Numbers
  1.  
  2. DoCmd.OpenForm "frmThatsBeenReferredTo", , , strCriteria
  3.  
Setting up the string is relatively easy. My preference is to declare a string variable for each of the terms to be involved in the filter. I'll call them s1, s2, s3 etc but it is usually more helpful to represent the fieldnames. Then
Expand|Select|Wrap|Line Numbers
  1. strCriteria = s1 & s2 & s3 ' . . . etc
  2. DoCmd.OpenForm "frmThatsBeenReferredTo", , , strCriteria
Obviously s1 must be somthing like "[ID]>1" so the term is always present, then s2 can be "and [LangID]=" & Me.txtLangID, or if you are not filtering on LangID then s2="". Get the idea? You will have to be careful setting up you criteria terms as to which are text values, which are numbers and which are dates to get the correct syntax.

I normally set all the terms (except first) to blank and then adjust them on the After_Update event of the unbound text box. So if there was a box called txtLangID the code would be something like;
Expand|Select|Wrap|Line Numbers
  1.  If Me!txtLangID = "" Then 
  2. s2 =""
  3. Else
  4. s2 = "and [LangID] =" & Me!txtLangID
  5. EndIf
  6.  
Get the basic idea working on a few fields then come back if there are any problems.

I think that with the references already given you should be alright. I would leave the more ambitious 'multi-select' aspect until the basics work ok.
S7
Feb 22 '08 #13

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

Similar topics

4
by: Rizyak | last post by:
This message is cross posted in alt.comp.lang.php & comp.lang.javascript I have a form for a user to input an establishment's hours and what time an event is taking place. After the user inputs...
2
by: jkmambo | last post by:
Suppose I have two tables A and B Table A has fields A1, A2, A3, ... A9 Table B has fields B1, B2, B3, ... B9 I want to select all fields in A and only B3 in table B. I dont want to list...
1
by: Elias Farah | last post by:
Hello All, I hope someone can give me (and other keen access enthusiasts) some helpful information to explain how to most efficiently filter Queries & subqueies. Consider this common simple...
1
by: Ramesh | last post by:
hi, I am selecting fields from three table for manupulating data and i want to display total number of records selected. But i am always getting -1 value, eventhough 1000 of records are selected....
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
3
by: JDiamond | last post by:
Hi, I have a table called Hosts. The Hosts table contains the following fields: Each field represents a step in the project. The tech that completes each step initials the respective...
0
by: Gordon Youd | last post by:
Hi, the group helped me with my last post "Select query from query1 or query2". How do I show " JourneyBookingFormQuery.Req ArrTime" on the "Out column in sortkey" but not in "In column in...
2
NeoPa
by: NeoPa | last post by:
CHAPTER 1 - TABLE OF CONTENTS (Including attached database) CHAPTER 2 - INTRODUCTION CHAPTER 3 - TABLE LAYOUT CHAPTER 4 - FORM LAYOUT CHAPTER 5 - FORM MODULE CHAPTER 6 - CODE DISCUSSION (FILTER...
3
NeoPa
by: NeoPa | last post by:
Cascaded Form Filtering CHAPTER 1 - TABLE OF CONTENTS (Including attached database) CHAPTER 2 - INTRODUCTION CHAPTER 3 - TABLE LAYOUT CHAPTER 4 - FORM LAYOUT CHAPTER 5 - FORM MODULE CHAPTER 6...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.