F
Frederick Chow
Hi all,
I am a newbie in Access and have some problems in the DLookup function...
Step to replicate the problem.
1. Create a table called "FirstTable" with two text fields, "Username" and
"Password".
2. In the FirstTable, fill in two records like ("Mary", "12345"), ("John",
"45678")
3. Go to VBA Editor and in the immediate window, type:
- ? DLookup("[UserName]", "FirstTable", "[UserName]=Username")
- Result: Mary
-? DLookup("[UserName]", "FirstTable", "[UserName]=Mary")
- Result: Runtime error '2001' - You canceled the previous operation.
My question:
1. Why "[FieldName]=Fieldname" in the criteria part of the function will
return the first record? Shouldn't it return Null instead?
2. I really can't understand the error message in the second case.
Thanks for your help in advance.
Frederick Chow
Hong Kong.
I am a newbie in Access and have some problems in the DLookup function...
Step to replicate the problem.
1. Create a table called "FirstTable" with two text fields, "Username" and
"Password".
2. In the FirstTable, fill in two records like ("Mary", "12345"), ("John",
"45678")
3. Go to VBA Editor and in the immediate window, type:
- ? DLookup("[UserName]", "FirstTable", "[UserName]=Username")
- Result: Mary
-? DLookup("[UserName]", "FirstTable", "[UserName]=Mary")
- Result: Runtime error '2001' - You canceled the previous operation.
My question:
1. Why "[FieldName]=Fieldname" in the criteria part of the function will
return the first record? Shouldn't it return Null instead?
2. I really can't understand the error message in the second case.
Thanks for your help in advance.
Frederick Chow
Hong Kong.