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

Search function assistance needed!

56
I've got a listbox which is pulling up:

Merchant
Merchant Code
Description
Price

and what I would like to do is have a textbox drive what the listbox
is displaying. Basically I can get the table selection behind the
scenes sorted ok, so I've got a combobox driving where you are
searching "ie Merchant Code/Description", but what I don't know is how
to get the search part of things working.

This is what I have so far :

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command13_Click()
  2.  
  3.     If Combo8 = "Description" Then
  4.         SQLTab = "AllPrices.Description"
  5.     ElseIf Combo8 = "Manufacturer Code" Then
  6.         SQLTab = "AllPrices.[Manu Code]"
  7.     ElseIf Combo8 = "Merchant Code" Then
  8.         SQLTab = "AllPrices.[Product Code]"
  9.     End If
  10.  
  11.     List11.RowSource = "SELECT AllProducts.Supplier, AllPrices.
  12. [Product Code], AllPrices.Description, AllPrices.Price, AllPrices.
  13. [Core/Wider] & FROM AllPrices INNER JOIN AllProducts ON AllPrices.
  14. [Product Code] = AllProducts.[Product Code] WHERE " & SQLTab & " Like
  15. '" & Text6 & "'"
  16.  
  17.     Debug.Print List11.RowSource
  18.  
  19. End Sub
  20.  
  21.  
Bit baffled as to why the Like doesn't work. Even when hard coding it
to a *.

Cheers for any help!
Jul 30 '07 #1
3 1348
JKing
1,206 Expert 1GB
Try changing it to
Expand|Select|Wrap|Line Numbers
  1. " Like '*" & Me.Text6 & "*'"
  2.  
If you hardcoded it to Like * that will produce nothing but Like '*' should produce all records.
Jul 30 '07 #2
Widge
56
Try changing it to
Expand|Select|Wrap|Line Numbers
  1. " Like '*" & Me.Text6 & "*'"
  2.  
If you hardcoded it to Like * that will produce nothing but Like '*' should produce all records.
Hm, nothing is returned. The debug comes out with this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT AllProducts.Supplier, AllPrices.[Product Code], AllPrices.Description, AllPrices.Price, AllPrices.[Core/Wider] & FROM AllPrices INNER JOIN AllProducts ON AllPrices.[Product Code] = AllProducts.[Product Code] WHERE AllPrices.Description Like '**'
  3.  
  4.  
Thats what baffles me, I would expect a * to bring up everything!
Jul 30 '07 #3
Widge
56
Hm, nothing is returned. The debug comes out with this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT AllProducts.Supplier, AllPrices.[Product Code], AllPrices.Description, AllPrices.Price, AllPrices.[Core/Wider] & FROM AllPrices INNER JOIN AllProducts ON AllPrices.[Product Code] = AllProducts.[Product Code] WHERE AllPrices.Description Like '**'
  3.  
  4.  
Thats what baffles me, I would expect a * to bring up everything!
Sorted it:

Expand|Select|Wrap|Line Numbers
  1.     List11.RowSource = "SELECT AllProducts.Supplier, AllPrices.[Product Code], AllPrices.Description, AllPrices.Price, AllPrices.[Core/Wider] FROM AllPrices INNER JOIN AllProducts ON AllPrices.[Product Code] = AllProducts.[Product Code] WHERE " & SQLTab & " Like '*" & Me.Text6 & "*'"
  2.  
Jul 30 '07 #4

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

Similar topics

1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
3
by: Dalan | last post by:
I need some assistance or advise in composing code for a global function module or a related one for populating values in text boxes on reports and forms with a name, actually several different...
11
by: Pete | last post by:
Is there any way to change the default search to "Any Part Of Field" instead of whole field? The first thing I ever do when searching for something in a field is change the default setting from...
19
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e.,...
3
by: Mark Kurten | last post by:
in the visual studio .NET samples that come with the product, why do javascript functions all have the parameters below. Even though, the event (like Onclick) which is calling it doesn't have any...
1
by: maryjones11289 | last post by:
Hi All, I'm trying to write/find code that creates a Ternary Search Tree in Visual Basic (VB6 or .NET). Here's my situation: What I have is an array consisting of 60,000 string elements. All...
10
by: B. Williams | last post by:
I have an assignment that requires me to write a program that uses a class, a constructor, a switch, and store the records in a text file. The second requirement is to create a function called...
1
by: midnightblue | last post by:
Please could someone help me. I am a relative newbie, and have the following function on my php search page on my Joomla! site. <?php } } function...
1
by: gautam89 | last post by:
Hi everyone... I'm a high school student working on an Access project for a summer internship. I needed your assistance in writing a criteria for a select query. Table1 has the following...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
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...
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.