DLookup returning Null instead of empty string

Status
Not open for further replies.
I think this has been mentioned before, but this is a known bug[/feature!]

See Allen Browne here

DLookup() has several shortcomings:

  1. ...
  2. ...
  3. ...
  4. It returns the wrong answer if the target field contains a zero-length string.
ELookup() addresses those limitations:

  1. ...
  2. ...
  3. ...
  4. It correctly differentiates a Null and a zero-length string.
 
This whole thread has intrigued me since, as most posters have said, the problem remain 'NOT UNDERSTOOD'. Thinking back to My C++ days I have a feeling that I might be that the API call used by the comparison wll use the empty string which is treated a null in C++, which theAPI is written in. This is just guesswork, I hasten to add!!

Secondly , as an aside why do you (as shown in a couple of the examples) want to look up the value of a value you already know to be ""? Also if you want to know the ID it will only identify the first record that matches, so what do yoywant to do with it?: only the thread starter can identify that but I can't.
 
Acting as a moderator, I have to step in for just a moment.

@Pat Hartman and @pdanes got into a discussion that became heated enough to lead to a report for improper behavior after post #20. I am not going to assign blame to someone, because both parties had strong feelings about the correctness of their viewpoints.

When we are dealing with members having a long history and experience with Access and we recognize that the problem under discussion is due to erroneous Access behavior, we should immediately recognize that all bets are off. If there is any blame, point to Microsoft for the incorrect behavior of their function. Be angry with them, not with each other. Once we realize we face incorrect Access behavior, we need a workaround for this behavior. Let us also remember that each of us will choose a workaround that is most comfortable to each of us as individuals and based on our specific situations.

Each person has a degree of "purist" and a degree of "pragmatist" in some proportion. We should recognize that with Access, there is often more than one way to fix a problem. Sometimes it will be a highly technical solution. Sometimes it will be a quick-and-dirty blow-out patch. And we have to try to hold our egos in check if we find that our choice of solution is either incorrect or unpopular or was not well accepted.

Nobody is going to be suspended for this. No threats. Just a request to recognize that we all know different things based on different viewpoints and different experiences. Let each of us be our different selves. Vive le difference.
 
If I am at fault (I don't think I am but ...)then mea culpa - sorry.
 
This whole thread has intrigued me since, as most posters have said, the problem remain 'NOT UNDERSTOOD'. Thinking back to My C++ days I have a feeling that I might be that the API call used by the comparison wll use the empty string which is treated a null in C++, which theAPI is written in. This is just guesswork, I hasten to add!!

Secondly , as an aside why do you (as shown in a couple of the examples) want to look up the value of a value you already know to be ""? Also if you want to know the ID it will only identify the first record that matches, so what do yoywant to do with it?: only the thread starter can identify that but I can't.
I don't know the value when I'm doing the lookup. I feed in the ID and expect to get back the value. Sometimes that value is blank, other times it's text. But I focused on the blanks because that is what is misbehaving. When the value is a non-empty text string, DLookup returns it correctly.

Some of the code examples I posted make it look like I already know, but that is because in this test case, I do know - it is the empty string that DLookup does not return corectly. But in my app, in operation, I do not know.

I didn't know about the C++ behavior, but that is certainly a reasonable guess.
 
Acting as a moderator, I have to step in for just a moment.

@Pat Hartman and @pdanes got into a discussion that became heated enough to lead to a report for improper behavior after post #20. I am not going to assign blame to someone, because both parties had strong feelings about the correctness of their viewpoints.

When we are dealing with members having a long history and experience with Access and we recognize that the problem under discussion is due to erroneous Access behavior, we should immediately recognize that all bets are off. If there is any blame, point to Microsoft for the incorrect behavior of their function. Be angry with them, not with each other. Once we realize we face incorrect Access behavior, we need a workaround for this behavior. Let us also remember that each of us will choose a workaround that is most comfortable to each of us as individuals and based on our specific situations.

Each person has a degree of "purist" and a degree of "pragmatist" in some proportion. We should recognize that with Access, there is often more than one way to fix a problem. Sometimes it will be a highly technical solution. Sometimes it will be a quick-and-dirty blow-out patch. And we have to try to hold our egos in check if we find that our choice of solution is either incorrect or unpopular or was not well accepted.

Nobody is going to be suspended for this. No threats. Just a request to recognize that we all know different things based on different viewpoints and different experiences. Let each of us be our different selves. Vive le difference.
Yeah, sorry about that. I get irked when someone thinks that a helpful contribution is to ignore my question and tell me I am doing it all wrong. And then continue to harp on it when I tell them I know what I want and am doing it that way on purpose.

But you're right - I overreacted. I should have just ignored her completely, and I will try to remember to do that in the future.
 
If I am at fault (I don't think I am but ...)then mea culpa - sorry.
You're not - I was. I let myself get provoked by foolishness when I should have just ignored it. Sorry to everyone who got exposed to that.
 
Yeah, sorry about that. I get irked when someone thinks that a helpful contribution is to ignore my question and tell me I am doing it all wrong. And then continue to harp on it when I tell them I know what I want and am doing it that way on purpose.
...I should have just ignored her completely, and I will try to remember to do that in the future.
... I let myself get provoked by foolishness when I should have just ignored it.


Wow, that changed my mind, it's not a split decision. Pat Hartman wins by TKO. It's like you threw in the towel and just decided to land low blows for the rest of the match.

Pat took the high road and dropped out, so I feel I have to speak on her behalf: You just can't leave it alone, even in that "apology" you took several digs at her. And that's not even counting your 400+ word Post #20 manifesto about how horrible she is.

I didn't take sides on the tecnical issue in my initial post because I just wanted the boring bickering to end. But I will now--Pat was right on the technical aspect all along. But somehow you took it personal and got a little snippy in your first reply to her, then even more so with each volley.

So, I apologize to Pat for my initial post. I shouldn't have tried to stop the bickering I should have jumped in, agreed with her and piled on you when you went mean.
 
Wow, that changed my mind, it's not a split decision. Pat Hartman wins by TKO. It's like you threw in the towel and just decided to land low blows for the rest of the match.

Pat took the high road and dropped out, so I feel I have to speak on her behalf: You just can't leave it alone, even in that "apology" you took several digs at her. And that's not even counting your 400+ word Post #20 manifesto about how horrible she is.

I didn't take sides on the tecnical issue in my initial post because I just wanted the boring bickering to end. But I will now--Pat was right on the technical aspect all along. But somehow you took it personal and got a little snippy in your first reply to her, then even more so with each volley.

So, I apologize to Pat for my initial post. I shouldn't have tried to stop the bickering I should have jumped in, agreed with her and piled on you when you went mean.
Fine, except that she wasn't "right on the technical aspect all along". She was wrong on the technical part. If you agree with her, then you're wrong as well. She accused me of all sorts of crap I didn't say, and in #20, all I did was answer HER insults. Yeah, I overdid it.
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom