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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Error if no value



 
 
Thread Tools Display Modes
  #1  
Old August 4th, 2005, 06:35 PM
Dave Elliott
external usenet poster
 
Posts: n/a
Default #Error if no value

The below code is my control source for an unbound textbox. if there is no
value or o****, then I get the error; #Error
How can I eliminate this ?

=DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#"))


  #2  
Old August 4th, 2005, 06:47 PM
Gina Whipp
external usenet poster
 
Posts: n/a
Default

I would type:

=IIf (DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#")) 0, DCount("[EmployeeID]","Employees","[Work Date]
= " & Format([Work Date],"\#mm/dd/yyyy\#")), Null)

Basically, if there is a date, show the date else show nothing... but
someone might have a better idea.


"Dave Elliott" wrote in message
.. .
The below code is my control source for an unbound textbox. if there is no
value or o****, then I get the error; #Error
How can I eliminate this ?

=DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#"))



  #3  
Old August 4th, 2005, 06:56 PM
Klatuu
external usenet poster
 
Posts: n/a
Default

That requires 2 executions of the DCount. This may be better:

=Nz(DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#")),Null)

"Gina Whipp" wrote:

I would type:

=IIf (DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#")) 0, DCount("[EmployeeID]","Employees","[Work Date]
= " & Format([Work Date],"\#mm/dd/yyyy\#")), Null)

Basically, if there is a date, show the date else show nothing... but
someone might have a better idea.


"Dave Elliott" wrote in message
.. .
The below code is my control source for an unbound textbox. if there is no
value or o****, then I get the error; #Error
How can I eliminate this ?

=DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#"))




  #4  
Old August 4th, 2005, 08:35 PM
Dave Elliott
external usenet poster
 
Posts: n/a
Default

Both examples erred out ?
The end result is a count of course and the default count should be zero

"Klatuu" wrote in message
news
That requires 2 executions of the DCount. This may be better:

=Nz(DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#")),Null)

"Gina Whipp" wrote:

I would type:

=IIf (DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#")) 0, DCount("[EmployeeID]","Employees","[Work
Date]
= " & Format([Work Date],"\#mm/dd/yyyy\#")), Null)

Basically, if there is a date, show the date else show nothing... but
someone might have a better idea.


"Dave Elliott" wrote in message
.. .
The below code is my control source for an unbound textbox. if there is
no
value or o****, then I get the error; #Error
How can I eliminate this ?

=DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#"))






  #5  
Old August 4th, 2005, 09:38 PM
Krizhek
external usenet poster
 
Posts: n/a
Default

=IIf([Work Date]="", "",[DCount("[EmployeeID]","Employees","[Work Date] = " &
Format([Work Date],"\#mm/dd/yyyy\#")))

Hopefully this works for you.

"Dave Elliott" wrote:

The below code is my control source for an unbound textbox. if there is no
value or o****, then I get the error; #Error
How can I eliminate this ?

=DCount("[EmployeeID]","Employees","[Work Date] = " & Format([Work
Date],"\#mm/dd/yyyy\#"))



 




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 06:38 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.