Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Invalid use of null in dlookup

Posted on 2006-07-05
6
Medium Priority
?
508 Views
Last Modified: 2008-02-26
I keep getting an error message saying invalid use of null... please help.

Dim dSubject As String
Dim dResponsibility As String
dSubject = DLookup("designsubject", "tblpart", "isnull(DesignRespond) And DateDiff('d', DesignStartDate, Now()) <= 3")
dResponsibility = DLookup("designresponsibility", "tblpart", "DesignRespond Is Null And DateDiff('d', DesignStartDate, Now()) <= 3")
If Not IsNull(dSubject) Then
    DoCmd.SendObject acSendNoObject, , acFormatHTML, "rgrguric@yahoo.com", , , "Employee has not responded for DESIGN responsibility, please review!!!", "User " & dResponsibility & " has not responded for DESIGN responsibility on " & dSubject & ".", False
End If

Thanks,
0
Comment
Question by:rgrguric
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17045317

Dim dSubject As String
Dim dResponsibility As String
dSubject = DLookup("designsubject", "tblpart", "DesignRespond is null And DateDiff('d', DesignStartDate, Now()) <= 3")
dResponsibility = DLookup("designresponsibility", "tblpart", "DesignRespond Is Null And DateDiff('d', DesignStartDate, Now()) <= 3")
If Not IsNull(dSubject) Then
0
 

Author Comment

by:rgrguric
ID: 17045342
I put that in and I'm still receiveing the error same error message.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 17045396

Dim dSubject As variant
Dim dResponsibility As variant
dSubject = DLookup("designsubject", "tblpart", "DesignRespond is null And DateDiff('d', DesignStartDate, Now()) <= 3")
dResponsibility = DLookup("designresponsibility", "tblpart", "DesignRespond Is Null And DateDiff('d', DesignStartDate, Now()) <= 3")
If Not IsNull(dSubject) Then
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17045400
explanation: only VARIANT and OBJECT data types can get a NULL value, string, integer etc cannot (will raise the error you have)
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17045422
wrap DLOOKUP with ""


Dim dSubject As String
Dim dResponsibility As String


dSubject = NZ(DLookup("designsubject", "tblpart", "DesignRespond is null And DateDiff('d', DesignStartDate, Now()) <= 3"),"")
dResponsibility = NZ(DLookup("designresponsibility", "tblpart", "DesignRespond Is Null And DateDiff('d', DesignStartDate, Now()) <= 3"),"")

Now u can check for empty string

if dSubject = "" then
    msgbox "No Subject"
endif


U can use NZ to give a default value instead of "" instead
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17045425
wrap DLOOKUP with NZ is what Im supposed to have said, oops
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question