Solved

sql using like

Posted on 1998-07-28
2
116 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now