QUERY QUESTION

  • Thread starter Thread starter COMPSCI610
  • Start date Start date
C

COMPSCI610

WHAT DO I NEED TO DO WITH THIS QUERY TO GET IT TO TERMINATE ON A NULL STRING
OR 0?

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));
 
First, release the cap lock key. Use of all caps is taken as shouting, and
if regarded as rude.

Second, explain what you mean by "terminate", and where the 0 or null string
will occur. BTW, do you mean an empty string, a null value, or what
exactly?
 
COMPSCI610 said:
WHAT DO I NEED TO DO WITH THIS QUERY TO GET IT TO TERMINATE ON A NULL
STRING OR 0?

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));

Your caps lock key is stuck. Please unstick it.

What do you mean by "terminate"? Stop without returning any records?
Raise an error?
Do you understand what queries do? They assemble a set of records that
satisfy given criteria and return them to the caller. It's not a process
that "terminates" until the set of records is returned to the caller.
 
COMPSCI610 said:
WHAT DO I NEED TO DO WITH THIS QUERY TO GET IT TO TERMINATE ON A NULL
STRING OR 0?

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));

If the idea is that you only want to return records if none of the
fields contain a null in any of the records, then you can do something
like this:

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));
AND NOT EXISTS (
SELECT * FROM STORPOGTRASH WHERE [SPOG#] is Null or [POGSTR#] is Null)
 
WHAT DO I NEED TO DO WITH THIS QUERY TO GET IT TO TERMINATE ON A NULL STRING
OR 0?

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));

Please lay off the CAPS LOCK. It's hard to read and looks like you're
SHOUTING.

That said... what do you mean by "terminate"? A query isn't procedural, and
doesn't "run until it terminates" - it returns a recordset which might or
might not contain any records.

What's the context, and what do you want to happen?
 
Bob said:
COMPSCI610 said:
WHAT DO I NEED TO DO WITH THIS QUERY TO GET IT TO TERMINATE ON A NULL
STRING OR 0?

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));

If the idea is that you only want to return records if none of the
fields contain a null in any of the records, then you can do something
like this:

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));
AND NOT EXISTS (
SELECT * FROM STORPOGTRASH WHERE [SPOG#] is Null or [POGSTR#] is
Null)
errr - you should remove that semicolon ...
Corrected:
SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]))
AND NOT EXISTS (
SELECT * FROM STORPOGTRASH WHERE [SPOG#] is Null or [POGSTR#] is Null)
 
If 0 is entered as the planogram number or if the input box is left blank, I
would like the query to stop running. I have this set up in a Macro that
repeats over and over. This is why I need it to stop once invalid data is
inputed.

BruceM said:
First, release the cap lock key. Use of all caps is taken as shouting, and
if regarded as rude.

Second, explain what you mean by "terminate", and where the 0 or null string
will occur. BTW, do you mean an empty string, a null value, or what
exactly?

COMPSCI610 said:
WHAT DO I NEED TO DO WITH THIS QUERY TO GET IT TO TERMINATE ON A NULL
STRING
OR 0?

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));
 
You should stop the macro, not the query since it is already executed
(returning no result) in one of your possible scenario.


Vanderghast, Access MVP


COMPSCI610 said:
If 0 is entered as the planogram number or if the input box is left blank,
I
would like the query to stop running. I have this set up in a Macro that
repeats over and over. This is why I need it to stop once invalid data is
inputed.

BruceM said:
First, release the cap lock key. Use of all caps is taken as shouting,
and
if regarded as rude.

Second, explain what you mean by "terminate", and where the 0 or null
string
will occur. BTW, do you mean an empty string, a null value, or what
exactly?

COMPSCI610 said:
WHAT DO I NEED TO DO WITH THIS QUERY TO GET IT TO TERMINATE ON A NULL
STRING
OR 0?

SELECT STORPOGTRASH.[SPOG#], STORPOGTRASH.[POGSTR#]
FROM STORPOGTRASH
WHERE (((STORPOGTRASH.[SPOG#])=[PLEASE ENTER A PLANOGRAM NUMBER]));
 
Back
Top