A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Error as DLOOKUP result



 
 
Thread Tools Display Modes
  #1  
Old January 14th, 2009, 08:28 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default #Error as DLOOKUP result

I'm using the following:

=DLookUp("[NAME]","006_Employee_tbl","[EMP#]=" &
DLookUp("[EMPNO]","005_DMLog_tbl","[DM#]=[Forms]![002PaybackEntry_frm]![txtFergusonChargeback#]"))

It works fine when txtFergusonChargeback# is in 005_DMLog_tbl. But when it
isn't it returns "#Error". I need it to stay blank in that case. Any
suggestions?

Thanks!!
--
GD
  #2  
Old January 14th, 2009, 08:50 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default #Error as DLOOKUP result

The problem is that the inner DLookup is returning Null, and you can't use
Null with =.

Try:

=DLookUp("[NAME]","006_Employee_tbl","[EMP#]=" &
Nz(DLookUp("[EMPNO]","005_DMLog_tbl","[DM#]=[Forms]![002PaybackEntry_frm]![txtFergusonChargeback#]"),
0))

or even

=Nz(DLookUp("[NAME]","006_Employee_tbl","[EMP#]=" &
Nz(DLookUp("[EMPNO]","005_DMLog_tbl","[DM#]=[Forms]![002PaybackEntry_frm]![txtFergusonChargeback#]"),
0)), "Not found")

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


"GD" wrote in message
...
I'm using the following:

=DLookUp("[NAME]","006_Employee_tbl","[EMP#]=" &
DLookUp("[EMPNO]","005_DMLog_tbl","[DM#]=[Forms]![002PaybackEntry_frm]![txtFergusonChargeback#]"))

It works fine when txtFergusonChargeback# is in 005_DMLog_tbl. But when
it
isn't it returns "#Error". I need it to stay blank in that case. Any
suggestions?

Thanks!!
--
GD



  #3  
Old January 14th, 2009, 09:16 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default #Error as DLOOKUP result

Genius! Thanks, Doug!
--
GD


"Douglas J. Steele" wrote:

The problem is that the inner DLookup is returning Null, and you can't use
Null with =.

Try:

=DLookUp("[NAME]","006_Employee_tbl","[EMP#]=" &
Nz(DLookUp("[EMPNO]","005_DMLog_tbl","[DM#]=[Forms]![002PaybackEntry_frm]![txtFergusonChargeback#]"),
0))

or even

=Nz(DLookUp("[NAME]","006_Employee_tbl","[EMP#]=" &
Nz(DLookUp("[EMPNO]","005_DMLog_tbl","[DM#]=[Forms]![002PaybackEntry_frm]![txtFergusonChargeback#]"),
0)), "Not found")

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


"GD" wrote in message
...
I'm using the following:

=DLookUp("[NAME]","006_Employee_tbl","[EMP#]=" &
DLookUp("[EMPNO]","005_DMLog_tbl","[DM#]=[Forms]![002PaybackEntry_frm]![txtFergusonChargeback#]"))

It works fine when txtFergusonChargeback# is in 005_DMLog_tbl. But when
it
isn't it returns "#Error". I need it to stay blank in that case. Any
suggestions?

Thanks!!
--
GD




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.