473,581 Members | 2,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

MLH
if DLookup("[cSSN]", "tblAddressesEq uifax",
"[cSSN]=GetCurrentMemb erID()") then ? "Hello"

#AND#

if not DLookup("[cSSN]", "tblAddressesEq uifax",
"[cSSN]=GetCurrentMemb erID()") then ? "Hello"

both result in "Hello" being printed in the immediate
window. Access 2.0. Why???
Nov 13 '05 #1
1 1149
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 = GetCurrentMembe rID()

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

If Not IsNull(DLookup( "[cSSN]", "tblAddressesEq uifax", "[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(varFi ndThis) Then

If Not IsNull(DLookup( "FacultyNam e", "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.n et

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**@NorthStat e.net> wrote in message
news:ti******** *************** *********@4ax.c om...
if DLookup("[cSSN]", "tblAddressesEq uifax",
"[cSSN]=GetCurrentMemb erID()") then ? "Hello"

#AND#

if not DLookup("[cSSN]", "tblAddressesEq uifax",
"[cSSN]=GetCurrentMemb erID()") 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
10514
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
3645
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. However, they generate slightly different results for floating point numbers. Are they really supposed to generate exactly the same results? I...
29
520
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. However, they generate slightly different results for floating point numbers. Are they really supposed to generate exactly the same results? I...
6
4832
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 SalesManName AT Alan Time
0
7876
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7910
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1409
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1144
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.