473,666 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Filter Form using Combos

A2003, Xp Pro.

I've designed a form which contains 6 of combos. Three on the left are
set up to select fields from a query, three on the right are set up to
select values from the corresponding field selected on the left.

I use these combos to dynamically create a filter string to apply to my
main form. It all works fine as long as I select text fields using
quotation marks. My question is how do I handle different data types
such as numbers and currency?

I've tried using CStr() in a query but I get a 'You cancelled the
previous operation' (?!!) error when the filter is "applied".

Incidentally, I know I'm duplicating the 'filter by form' function but
there are reasons for this.

All advice gratefully received.

Regards,
Keith.
Nov 13 '05 #1
1 2053
I tried the Eval function, but got an error if the field was a text field.
Strange error, all it said was "Unknown".

Example:
WHERE fldMyField = Eval("23")
or
WHERE fldMyField = Eval("ABC")

The Eval function should return a string or number, as appropriate.

Since that didn't work, you will need to get the Field.Type property for the
field and adjust your syntax to match. Another option may be to not
concatenate the data from the combos on the right into the SQL string.
Instead, pass a reference to those combos and let the query get the values
from the combos.

Example:
WHERE fldMyField = Forms!frmMyForm !cboCombo1

Don't forget, that the Value of the combo box comes from its Bound Column,
which may or may not be the visible column. If it isn't you'll either need
to refer to the Column property or allow for the value that is being passed.

--
Wayne Morgan
MS Access MVP
"Keith" <ke***@NOCARPke ithwilby.org.uk > wrote in message
news:cv******** **@titan.btinte rnet.com...
A2003, Xp Pro.

I've designed a form which contains 6 of combos. Three on the left are
set up to select fields from a query, three on the right are set up to
select values from the corresponding field selected on the left.

I use these combos to dynamically create a filter string to apply to my
main form. It all works fine as long as I select text fields using
quotation marks. My question is how do I handle different data types such
as numbers and currency?

I've tried using CStr() in a query but I get a 'You cancelled the previous
operation' (?!!) error when the filter is "applied".

Incidentally, I know I'm duplicating the 'filter by form' function but
there are reasons for this.

All advice gratefully received.

Regards,
Keith.

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5947
by: Johan | last post by:
I have made a form (filterform) where I can select 3 conditions, to open another form (showrecords), filtered with the 3 conditions. On the filterform: 3 drop down boxes, where the user kan choose: name, machine, area. And a button "start search". By clicking the button, showrecords opens with filter: name = x and machine = y and area = z. That works good!
22
6093
by: James Cane | last post by:
Here's an interesting problem that someone might have an answer to... Some time ago, I wrote a set of utility classes which wrap up the custom row source function needed to add arbitrary items to a combo or listbox. It all works nicely and allows me to do things such as sorting by clicking on column headings. Recently, all the machines here were upgraded to Access XP from 97 and I thought it might be time to take advantage of the new...
18
13592
by: Darryl Kerkeslager | last post by:
I don't do much with subforms - in fact I've deliberately avoided them - but .... I have a tab control that will contain several subforms, each bound to a separate table, and each table/subform will relate to the same person - but the subform data will not be 'linked' to the main form. I want to have one Cancel button for all the undo operations on all the subforms, so the individul subform's Public Sub, Form_Cancel will be called...
4
3034
by: Keith | last post by:
A2003, XP Pro. I'm in the middle of designing a form to act as a custom filter, like a very basic 'filter by form'. It has two sets of combos, those on the left are to choose the field name(s) on which to filter, those on the right to choose the value(s) from the chosen field(s). The idea is to build up a dynamic SQL string on which to filter the recordset. I thought I'd be able to overcome the data type issue by using CStr() in the...
5
3284
by: Steven C | last post by:
Hello: This should be a simply question for most of you guys. Obviously, I'm new to C#. I'm trying to add a base form objects base class to my project, so I can pre-configure textboxes, combos, etc, with a blue backcolor, to be used on all my forms. I compiled this, but when I use it on my form, the custom control properties are not being set. What am I missing here? Many thanks!
7
3338
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid, theres a requirement to show a drop down menu list (this is a control I downloaded online) in one of the columns. For the purposes of this question, Ive implemented the drop down menu as a drop down list instead. Ive got all this working at this...
4
5822
by: ThunderMusic | last post by:
Hi, I have a custom form that works fine when I debug it or run it in release mode but cannot be loaded in the designer... Actually, it can be loaded in the designer when no control is on it, but the resizing tool (in the designer) is offset both horizontally and vertically and when I put a control on it, as soon as I save, the designer throws an exception (but cannot be reproduced everytime) and the form cannot be loaded anymore unless...
9
2317
by: angi35 | last post by:
Hi - In Access 2000, I'm trying to create a switchboard so users can open a certain form with different filters. I thought I would use an option group with toggle buttons. I suppose it could be just a series of command buttons instead. Either way, I can't figure out the code to get Access to both open a form and filter it at the same time. Part of my trouble is also that the terms I need to filter on are multiple words, and I'm really...
3
1615
by: Salad | last post by:
Using A97, SP2, most current jet35. I have a search form. The op enters an id to search/find. If found, a data entry form is presented for that id. This form has 7 or 8 combos, a bunch of textboxes, and some command buttons. At the client site yesterday the user got a "too many databases open" after entering a bunch of IDs into the search form. Later that day, after entering a bunch more IDs, she got an out of memory error and the...
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8552
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.