Query not working if result is Null

Pusher

BEOGRAD Put
Local time
Today, 06:46
Joined
May 25, 2011
Messages
230
Hello all,
I have a query that gets the device and details from the location were they are located. The location is selected in a form. I have a location without the device but with the details.If the device is not null I get the results of the query, but if the device is null, I get that everything is null including the details that is not null. How do I fix this?


Thanks
 
Pusher, haven't we done something like this before?
 
This query is old, it worked fine but then I came upon a record that is specific, like this one that has no device (the device on this location is old and one of its kind) and in the details of that record there is information of this fact. When I run this simple query I don’t get anything and should have Device=Null and Details: Old Device…
Sorry for the inconvenience and for my ignorance if we did this already :(
 
Sorry for the inconvenience and for my ignorance if we did this already :(
I was only asking if we had done something like this before ;)

So I'm having trouble understanding what the problem is. Can you give me a scenario.
 
Hello all,
I have a query that gets the device and details from the location were they are located. The location is selected in a form. I have a location without the device but with the details.If the device is not null I get the results of the query, but if the device is null, I get that everything is null including the details that is not null. How do I fix this?


Thanks

It would be useful for us to see the actual Query. For instance, of the Tables/Queries are joined on the Device ID, and there is no Device ID, than that information would not be available. Once we see the Query, we can probably be of more assistance.
 
The query is QryRaskrsnica [gets the location from the Form IZVESTAJ - field IME Raskrsnice ] and the location that is the problem is Svetozara Markovića-V. Milenka. In the table RASKRSNICA - the record with Svetozara Markovića-V. Milenka - does not have ID_Uredjaja but it has DETALJI.
 

Attachments

Your explanations aren't clear.

I can see the query you are talking about and I can see that Milenka doesn't have a value in ID_Uredajaja. But I don't understand your question now because these are two different fields plus I don't speak Polish ;)
 
Select Svetozara Markovića-V.Milenka in IZVESTAJ IME RASKRSNICE and start QryRASKRSNICA. Everything is Null and i want to see the DETALJI. The question is why do i get the Null value, in everything, in this query when one of the results is Null?
 
The same problem is in my QrySearchRASKRSNICA that I use for searching thru my table. I don’t get the results for the streets that do not have ID_Uredjaj. This is a simple form – you will understand it better.
Form is FrmPretraga – enter Svetozara Markovića in the criteria for the search and you will get every record except Svetozara Markovića-V. Milenka.
 
The same problem is in my QrySearchRASKRSNICA that I use for searching thru my table. I don’t get the results for the streets that do not have ID_Uredjaj. This is a simple form – you will understand it better.
Form is FrmPretraga – enter Svetozara Markovića in the criteria for the search and you will get every record except Svetozara Markovića-V. Milenka.

Hi..
Try changing the query in this way..

QrySearchRASKRSNICA


SELECT
DISTINCTROW RASKRSNICA.IME_RASKRSNICE, UREDJAJ.TIP, TEREN.TEREN, RASKRSNICA.DETALJI
FROM UREDJAJ
RIGHT JOIN (TEREN INNER JOIN RASKRSNICA ON
TEREN.ID_TEREN = RASKRSNICA.ID_TEREN) ON UREDJAJ.ID_UREDJAJA = RASKRSNICA.ID_UREDJAJA
GROUP BY RASKRSNICA.IME_RASKRSNICE, UREDJAJ.TIP, TEREN.TEREN, RASKRSNICA.DETALJI
HAVING (((RASKRSNICA.IME_RASKRSNICE)
Like "*" & [Forms]![FrmPretraga]![kriterijum] & "*")) OR
(((RASKRSNICA.DETALJI) Like "*" & [Forms]![FrmPretraga]![kriterijum] & "*"));


QryRASKRSNICA

SELECT UREDJAJ.TIP, RASKRSNICA.DETALJI
FROM UREDJAJ RIGHT JOIN RASKRSNICA ON UREDJAJ.ID_UREDJAJA = RASKRSNICA.ID_UREDJAJA
WHERE (((RASKRSNICA.ID_RASKRSNICE)=[Forms]![IZVESTAJ]![ID_RASKRSNICE]));
 
Last edited:
That did it :) Thanks
if you could tell me what you did there I would be grateful :P
 

Attachments

  • 2011-11-23_112657.jpg
    2011-11-23_112657.jpg
    59.4 KB · Views: 106

Users who are viewing this thread

Back
Top Bottom