Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2008

Tip: Looking for answers? Try searching our database.

dlookup

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AccessMan - 30 Jul 2008 22:10 GMT
I am using two successive DLookUp statements against the same table with
different criteria after a form button is clicked.  Sometimes, the second
statement generates an "invalid use of NULL" error, and I can't figure out
why.  It is certainly not a data issue.  Both calls involve valid criteria.  
Has anybody run into a timing issue?  Could the first DLookUp have not closed
down its access to the table before the second DLookUp starts?  If I comment
out either one of the DLookUp statements the error does not arise.

Thanks!!!
Douglas J. Steele - 31 Jul 2008 01:26 GMT
Difficult to say what the problem is without seeing your actual code.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I am using two successive DLookUp statements against the same table with
> different criteria after a form button is clicked.  Sometimes, the second
[quoted text clipped - 8 lines]
>
> Thanks!!!
Mike Painter - 31 Jul 2008 02:22 GMT
> I am using two successive DLookUp statements against the same table
> with different criteria after a form button is clicked.  Sometimes,
[quoted text clipped - 6 lines]
>
> Thanks!!!

Try a Do Events between the two.
AccessMan - 31 Jul 2008 03:21 GMT
Mike - I'm not familiar with that statement, and help was not helpful.  Could
I ask for the exact syntax please?

> > I am using two successive DLookUp statements against the same table
> > with different criteria after a form button is clicked.  Sometimes,
[quoted text clipped - 8 lines]
>
> Try a Do Events between the two.
Mike Painter - 01 Aug 2008 00:11 GMT
> Mike - I'm not familiar with that statement, and help was not
> helpful.  Could I ask for the exact syntax please?

It's all one word and it just lets the system catch up with things before
going on.
99.9% of teh time event driven ssoftware is a good thing but sometimes one
event will start before an earlier needed one gets finished.

some code ges here
DoEvents
some more code goes here
J_Goddard - 31 Jul 2008 03:59 GMT
The problem might not be the DLookup statement itself, but what you are doing
with the results.  Are you sure that both DLookup statements return a value
(i.e. there is a record that meets the criteria), even though though the
criteria itself is valid?  If the DLookup returns a Null, you will often get
this error unless you handle a Null using (for example) the Nz function:

MyVariable = Nz(Dlookup(...), 0 ) for numeric data.

You should also verify that the Field you are querying using the DLookup does
not contain Null.

John

>I am using two successive DLookUp statements against the same table with
>different criteria after a form button is clicked.  Sometimes, the second
[quoted text clipped - 5 lines]
>
>Thanks!!!

Signature

John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.