473,385 Members | 1,397 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,385 software developers and data experts.

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 2032
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***@NOCARPkeithwilby.org.uk> wrote in message
news:cv**********@titan.btinternet.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
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...
22
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...
18
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...
4
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)...
5
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,...
7
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,...
4
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...
9
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...
3
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.