PC Review


Reply
Thread Tools Rate Thread

Where Condition & Quotation Marks

 
 
Melissa
Guest
Posts: n/a
 
      20th Mar 2009
Please help! I'm very confused about using quotation marks in the where
condition of code. I'm trying to figure it out. Could somebody please let
me know what's wrong with the following line of code? All my database is
returning is when Status Is Null.

"Status < '5' & ""Or"" & Status Is Null"

What it should give me is all conditions where Status < 5 or where Status Is
Null.
--
Thanks.
 
Reply With Quote
 
 
 
 
Jim Burke in Novi
Guest
Posts: n/a
 
      20th Mar 2009
It depends on whether status is a numeric value or a text field. If it's
numeric you'd use

"Status < 5 Or Status Is Null"

if it's text it would be

"Status < ""5"" Or Status Is Null"

That's if you have the 5 hard-coded. If that value was coming from, say, a
recordset or a form textbox, etc, it would be

for numeric:

"Status < " & RecordsetOrTextboxValue & " Or Status Is Null"

for text value:

"Status < """ & RecordsetOrTextboxValue & """ Or Status Is Null"




"Melissa" wrote:

> Please help! I'm very confused about using quotation marks in the where
> condition of code. I'm trying to figure it out. Could somebody please let
> me know what's wrong with the following line of code? All my database is
> returning is when Status Is Null.
>
> "Status < '5' & ""Or"" & Status Is Null"
>
> What it should give me is all conditions where Status < 5 or where Status Is
> Null.
> --
> Thanks.

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      20th Mar 2009
This is an excellent resource:
http://www.mvps.org/access/forms/frm0031.htm
http://www.mvps.org/access/queries/qry0001.htm

Also, IsNull is one word, not two words.

Finally, for a post a while back, "Me" is shorthand for the form or report
that the code is running on. If you have a form open called Form1 you can
refer to that form by the code Forms!Form1. However, if the code is on Form1,
you can shorten the previous to just Me. Me only works in VBA, it doesn't
work in the Control Source of calculated controls.

The "!" after the Me is just a separator between components making up the
path to the object being referred to.

HTH,
Ryan---



--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Melissa" wrote:

> Please help! I'm very confused about using quotation marks in the where
> condition of code. I'm trying to figure it out. Could somebody please let
> me know what's wrong with the following line of code? All my database is
> returning is when Status Is Null.
>
> "Status < '5' & ""Or"" & Status Is Null"
>
> What it should give me is all conditions where Status < 5 or where Status Is
> Null.
> --
> Thanks.

 
Reply With Quote
 
Jim Burke in Novi
Guest
Posts: n/a
 
      20th Mar 2009
In VBA code there is an IsNull function, e.g. IsNull(Status). If you code it
in SQL you use Is Null, e.g. Status Is Null.

"ryguy7272" wrote:

> This is an excellent resource:
> http://www.mvps.org/access/forms/frm0031.htm
> http://www.mvps.org/access/queries/qry0001.htm
>
> Also, IsNull is one word, not two words.
>
> Finally, for a post a while back, "Me" is shorthand for the form or report
> that the code is running on. If you have a form open called Form1 you can
> refer to that form by the code Forms!Form1. However, if the code is on Form1,
> you can shorten the previous to just Me. Me only works in VBA, it doesn't
> work in the Control Source of calculated controls.
>
> The "!" after the Me is just a separator between components making up the
> path to the object being referred to.
>
> HTH,
> Ryan---
>
>
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Melissa" wrote:
>
> > Please help! I'm very confused about using quotation marks in the where
> > condition of code. I'm trying to figure it out. Could somebody please let
> > me know what's wrong with the following line of code? All my database is
> > returning is when Status Is Null.
> >
> > "Status < '5' & ""Or"" & Status Is Null"
> >
> > What it should give me is all conditions where Status < 5 or where Status Is
> > Null.
> > --
> > Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My question marks, apostrophies and quotation marks are weird. pj Microsoft Word Document Management 1 10th Jan 2008 09:26 AM
Why do quotation marks change to question marks in e-mails receiv. =?Utf-8?B?SiBIZXJuZG9u?= Microsoft Outlook Discussion 0 30th May 2007 08:01 PM
Quotation Marks? LinearChaos Microsoft Excel Worksheet Functions 2 25th Jun 2006 10:31 PM
quotation marks =?Utf-8?B?Sm9obkY=?= Microsoft Excel Worksheet Functions 7 5th Feb 2006 09:33 PM
Punctuation marks and quotation marks 29erKilo Microsoft Word New Users 8 19th Aug 2004 02:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:28 AM.