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 ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

IIf Help!!! again

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fia - 23 Mar 2005 15:52 GMT
Hi
Thank's for the help I got, but I have another problem.
When Ord is a string I get Error 13, Type mismatch. I thougt the code below
would give me the result Ord, because it isn't True or False, not an error.
How can I escape that?

IIf(Ord=True,-1,IIf(Ord=False,0,Ord))

Thank's
Fia
JaRa - 23 Mar 2005 16:37 GMT
Try using Cbool(ord) maybe this resolve it.

Basically this functions casts your value to an boolean value

- RAoul

> Hi
> Thank's for the help I got, but I have another problem.
[quoted text clipped - 6 lines]
> Thank's
> Fia
Wayne Morgan - 23 Mar 2005 19:48 GMT
Why is Ord a string? What are some of the possible values that may be placed
in Ord? As JaRa mentioned, you may be able to use CBool() to get around the
type mismatch error, but whether this will do what you want or not will
depend on what the possible values for Ord are and what exactly you are
trying to accomplish.

Judging from your expression, I'm guessing that if the text in Ord is "True"
or "False" that you want a Boolean value of True or False returned,
otherwise you want the text in Ord returned. While this can be done,
depending on where you put that result, you may still wind up with a type
mismatch, not from the expression itself, but from the assignment of where
you're sending the result to. If this is just the Control Source of a
calculated textbox, then you should be ok.

IIf(Ord = "True", True, IIf(Ord = "False", False, Ord))
or
IIf(Ord = "True", -1, IIf(Ord = "False", 0, Ord))

The two expressions above are equivalent. There is a difference between the
word True and the value True, which is why the quotes are positioned as they
are in the first expression.

Signature

Wayne Morgan
MS Access MVP

> Hi
> Thank's for the help I got, but I have another problem.
[quoted text clipped - 5 lines]
>
> IIf(Ord=True,-1,IIf(Ord=False,0,Ord))
 
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



©2008 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.