Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

the format in sql word "like"

Posted on 2000-02-19
2
Medium Priority
?
135 Views
Last Modified: 2012-05-04
I want to make a key word searching.
Firstly,I try to use the sql word "like",but can't get the correct format for the word,because I used a string variable,how can I write the correct format to fulfill this requirement?Or someone else can suggest me a better way to do this?pls be quick,for I am in a hurry to complete the task.Thanks in advance.
0
Comment
Question by:buddha68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Expert Comment

by:paulstamp
ID: 2538377
Not entirely sure what you mean -are you talking about in a DB or with variables.

If using variables... use INSTR(SourceString, Match), ie

in instr(Target, "ThisString") <> 0 then msgbox "Found 'ThisString' in " & target

instr returns the position within the first string or the second string or 0 if there is no match, ie will return 2 if you do instr("band, "and")

Hope thats what you mean.
0
 
LVL 6

Accepted Solution

by:
Marine earned 200 total points
ID: 2538384
like condition can be expressed like this.
sSQL = "SELECT * FROM TableName where FieldName Like '%Name%'"
this would work
or if you need it to read it from a text box something like this will do
sSQL = "SELECT * FROM TableName where Name LIKE %'" & Text1.Text & "'%"

OR
LIKE '%" & Text1.Text & "%'
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question