I'm trying to use a textbox to search and display records as each letter is
typed in - similar to the behavior of a combo box. But for some reason I
can't seem to get the wildcard search character to work in my query. In the
example below, I have several records in tblEntity that begin with "m" and
"mi" and one record with the company name "microsoft" . I get a match only
when I type in the full string "microsoft" .
Why no match before then?
If you have any suggestions on a better way to do this, I'm all ears, but
I'm still curious why the wildcard is not working.
Thanks in advance.
[qryFind]
SELECT Entity_ID
FROM tblEntity
WHERE Company Like QryPrm("frm0"," txtFind");
[note: QryPrm is a function that returns the parameter]
[procedure on frm0]
Private Sub txtFind_KeyUp(K eyCode As Integer, Shift As Integer)
strFind = Me!txtFind & "*"
lngEid = Nz(DMax("Entity _ID", "qryFind"), 0)
Debug.Print strFind
Debug.Print lngEid
End Sub
[output]
m*
0
mi*
0
mic*
0
micr*
0
micro*
0
micros*
0
microso*
0
microsof*
0
microsoft*
1466 2 4171
On Sat, 01 Jan 2005 04:55:55 GMT, "deko"
<www.clearpoint systems.com@use _contact_form.c om> wrote: I'm trying to use a textbox to search and display records as each letter is typed in - similar to the behavior of a combo box. But for some reason I can't seem to get the wildcard search character to work in my query. In the example below, I have several records in tblEntity that begin with "m" and "mi" and one record with the company name "microsoft" . I get a match only when I type in the full string "microsoft" .
Why no match before then?
If you have any suggestions on a better way to do this, I'm all ears, but I'm still curious why the wildcard is not working.
Thanks in advance.
[qryFind] SELECT Entity_ID FROM tblEntity WHERE Company Like QryPrm("frm0"," txtFind"); [note: QryPrm is a function that returns the parameter]
[procedure on frm0] Private Sub txtFind_KeyUp(K eyCode As Integer, Shift As Integer) strFind = Me!txtFind & "*" lngEid = Nz(DMax("Entity _ID", "qryFind"), 0) Debug.Print strFind Debug.Print lngEid End Sub
[output] m* 0 mi* 0 mic* 0 micr* 0 micro* 0 micros* 0 microso* 0 microsof* 0 microsoft* 1466
Hi
This won't work for each character typed in, the Dmax function will
only see what you have typed when the record is saved.
Why not use a combo box?
David
> This won't work for each character typed in, the Dmax function will only see what you have typed when the record is saved.
10-4. what I did was bound the textbox and and then did everything on
keyup - i.e. saved the record, reset the rowsource of my list to the query
below, and then set selstart of the textbox to the length of the string it
contains. works fantastic. The key to getting the wildcard search working
was the magic '*' + string + '*' syntax
SELECT DISTINCT Entity_ID, FullName, Company
FROM qry1000
WHERE Company Like (QryPrm("frm0", "QuickSearc h") + '*') Or LastName Like
(QryPrm("frm0", "QuickSearc h") + '*') Or FirstName Like
(QryPrm("frm0", "QuickSearc h") + '*');
Why not use a combo box?
lots of reasons... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert Brown |
last post by:
I have researched newsgroups and the web very thoroughly and
unsuccessfully for a solution to what I believe is a very common
problem. I know it's easy to do wildcard match against data in DB
(using LIKE and "%" and "?").
But is it possible to match a concrete string against a database of
wildcarded data? ("%" and LIKE do not work). For example:
CREATE TABLE blacklist (
|
by: Dave Smithz |
last post by:
Hello there,
Summary:
How far can you go with SQL Select queries using like clauses with wildcard
characters. Can you apply anything like regular expressions?
Full details:
On a Intranet website, I request a code from a user which is then compared
with a code in an ADO access database.
|
by: Law.Win |
last post by:
I have an IIF statement in the criteria of a query. I would like to
know how to use a wildcard with the varaibles inside it.
For example IIF(, , )
I would like the wildcard after variable 2.
Thanks in advance
|
by: Torsten |
last post by:
I am attempting to issue an SQL query in C# to and Access database using the
Microsoft.Jet.OLEDB.4.0 provider. The only wildcard character that seems to
work is ‘%’. When using ‘#’, ‘?’, and ‘*’ as wildcards, the results returned
are always null. An example of a query that does work is:
SELECT SampleIndex
FROM SampInfo
|
by: wkehowski |
last post by:
The python code below generates a cartesian product subject to any
logical combination of wildcard exclusions. For example, suppose I want
to generate a cartesian product S^n, n>=3, of that excludes
'*a*b*' and '*c*d*a*'. See below for details.
CHALLENGE: generate an equivalent in ruby, lisp, haskell, ocaml, or in
a CAS like maple or mathematica.
#-------------------------------------------------------------------------------
# Short...
| |
by: Bruce Lawson |
last post by:
Hi, I am confused about Microsofts description of this Transact SQL
reference; (Wildcard - Character(s) to Match. The description says
"Matches any single character within the specified range or set that is
specified inside the square brackets". For example, in the TransactSQL
statement "UPDATE tblUsers SET = stringUserPassword WHERE UserId
= 2" , what do the brackets signify about the database record in column
Password being updated? ...
|
by: Dave |
last post by:
I need to filter an Access 2000 result set in ASP 30 using the ADO
recordset.filter.
I build the filter in pieces. The first clause of the filter is this...
WHERE word LIKE 'S%'
... to which other clauses are appended with AND.
This all works fine as long as I provide a condition for the first clause
|
by: Arch Stanton |
last post by:
I have an aspx page with a text box. My user enters text to search for
and presses a button; the text is passed via a QueryString to another
aspx page and used in a SQL search. The wildcard character is a percent
sign.
This works great if I place the % at the end of a search string, but I'm
getting peculiar errors if I start the search string with the wildcard
character. My search string seems to be altered at the front, and I
can't...
|
by: savage678 |
last post by:
Hi Everyone,
I am new to this forum and am i dire need of some help. I am trying to use wildcard searches in infopath. I have it connected to an access database using data connection.
I have some code which will allow me to do it but i dont know how to change the code. Could someone please help me. I have added the code for you to.
function MyQuery::OnClick(eventObj)
{
// Get the default SQL command for the form.
var...
|
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |