Solved

Sql Statement

Posted on 2000-02-24
9
169 Views
Last Modified: 2010-05-02
HI,

I am having a problem with a sql statement.
What i am trying to do is, a search in a table on a paradox database. The field is of type Long integer.
I am doing a search criteria where the field Error is equal to nothing, eg: the field is blank, has no data what so ever in it.
This is my statement :
SqlReadNoErrors = "SELECT * FROM Entry_de where Error = " & Null & ""
When i run the code it gives a syntax error, operator missing...

What could be wrong?

Thanks!
0
Comment
Question by:mscala
  • 5
  • 2
  • 2
9 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2556875
change
SqlReadNoErrors = "SELECT * FROM Entry_de where Error = " & Null & ""

to

SqlReadNoErrors = "SELECT * FROM Entry_de where Error = " & Null & "
0
 

Expert Comment

by:pinshah
ID: 2556880
try doing this

"where Error  = Null" instead of

"where Error = " & Null & "" as the tool or language in which u r making ur application can have different meaning for Null then the underline database

if u concatenate the Null it will be transformed to a value which ur application knows and it may not be compatible with the database.


0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2556892
try this one.
SqlReadNoErrors = "SELECT * FROM Entry_de where Error Is Null
0
 

Author Comment

by:mscala
ID: 2556901
Ruchi - firstly u are leaving out one of the " which it needs in.

pinshah - i don't necessarliy have to use Null, it was just something i was trying, for i am not looking for a value of null, i am searching for a blank value...
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Expert Comment

by:Ruchi
ID: 2556903
SqlReadNoErrors = "SELECT * FROM Entry_de where Error = ''

This code and The above I posted are the same thing.
0
 
LVL 9

Accepted Solution

by:
Ruchi earned 50 total points
ID: 2556908
I miss the enclosing " on the same line.

SqlReadNoErrors = "SELECT * FROM Entry_de where Error = ''"

SqlReadNoErrors = "SELECT * FROM Entry_de where Error Is Null"

0
 

Expert Comment

by:pinshah
ID: 2556910
I think '' is not same as is Null or Null '' is a empty string and Null has a different value which applies not only for strings but also for other datatypes. If error is a number it will give a type mismatch ( or related database errror)
0
 

Author Comment

by:mscala
ID: 2556913
Thanks Ruchi, the Is Null worked.
Thanks very much
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2556919
Mscala, You are welcome! I'm glad that I could be of any help to you. :-)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

20 Experts available now in Live!

Get 1:1 Help Now