Solved

sql using like

Posted on 1998-07-28
2
121 Views
Last Modified: 2010-05-03
I'm using the following sql statement within my program and when it gets to the set option I get incorrect systax error.

qref.sql = "Select * from rates_zones where owner_id = " & ownzip & " zip_postal_code like " & fndnum
I have an option and a text box

If this option then
     take data from text box, along with a specific owner
     find all the record that are like the text box
end if

I have a case statement to add % signs at the end of the text data
0
Comment
Question by:MaryD
[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 2

Accepted Solution

by:
Jagar earned 50 total points
ID: 1466951
Your like statement should look like this

SELECT * FROM TABLE WHERE FIELD Like '%data%'

Notice the '
0
 

Author Comment

by:MaryD
ID: 1466952
Thanks, I looked at that statment but did'nt realize I had to put the single quote. Since I'm using a variable I created a variable for the single quote and added it.

dim qtch as variant
qtch = "''
dim onech as variant
onech = "%"

within case select

fndnum = qtch + numstr + onech + qtch

Thanks again
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

718 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