473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

If blah blah blah #AND# If Not blah blah blah produce same results. Why?

MLH
if DLookup("[cSSN]", "tblAddressesEquifax",
"[cSSN]=GetCurrentMemberID()") then ? "Hello"

#AND#

if not DLookup("[cSSN]", "tblAddressesEquifax",
"[cSSN]=GetCurrentMemberID()") then ? "Hello"

both result in "Hello" being printed in the immediate
window. Access 2.0. Why???
Nov 13 '05 #1
1 1144
Hi

IMHO, you're using the wrong syntax.
I believe that the criteria that you have in your DLookup will *always*
return one of two things ...
The value of "[cSSN]" (If it exists, ... and I assume that it is supposed
to be numeric) or Null (If it doesn't)

Try it this way:
*************************************
Private Sub Command0_Click()

Dim varFindThis
varFindThis = GetCurrentMemberID()

If IsNumeric(varFindThis) Then ' I'm assuming that the function is supposed
to return a numeric "ID" here

If Not IsNull(DLookup("[cSSN]", "tblAddressesEquifax", "[cSSN] =" &
varFindThis)) Then
Debug.Print "Hello"
Else
Debug.Print "Goodbye"
End If

End If

End Sub
*************************************

Note: This is the *actual* code that I used during testing, which seemed to
work fine:
*************************************
Private Sub Command0_Click()
Dim varFindThis
varFindThis = InputBox("Enter a numeric value to find", "Find a Value")

If IsNumeric(varFindThis) Then

If Not IsNull(DLookup("FacultyName", "tblFaculty", "[FacID] =" &
varFindThis)) Then
Debug.Print "Hello"
Else
Debug.Print "Goodbye"
End If

End If

End Sub
*************************************

--
HTH,
Don
=============================
E-Mail (if you must)
My*****@Telus.net

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"MLH" <CR**@NorthState.net> wrote in message
news:ti********************************@4ax.com...
if DLookup("[cSSN]", "tblAddressesEquifax",
"[cSSN]=GetCurrentMemberID()") then ? "Hello"

#AND#

if not DLookup("[cSSN]", "tblAddressesEquifax",
"[cSSN]=GetCurrentMemberID()") then ? "Hello"

both result in "Hello" being printed in the immediate
window. Access 2.0. Why???

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
31
by: JS | last post by:
We have the same floating point intensive C++ program that runs on Windows on Intel chip and on Sun Solaris on SPARC chips. The program reads the exactly the same input files on the two platforms....
29
by: JS | last post by:
We have the same floating point intensive C++ program that runs on Windows on Intel chip and on Sun Solaris on SPARC chips. The program reads the exactly the same input files on the two platforms....
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.