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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

using iif and like in control Source of report



 
 
Thread Tools Display Modes
  #1  
Old December 19th, 2009, 08:36 AM posted to microsoft.public.access.reports
Prohock
external usenet poster
 
Posts: 37
Default using iif and like in control Source of report

Simple question! I have a table that has a single field called [name]. I want
my report to display true if a name matches "bill". For exam if the field
value is "bill Jan" or "Jan Bill" it would be true, "Jan Mark" would be
false. Something like this:

=IIf([Name] Like "&bill&","true","false")
  #2  
Old December 19th, 2009, 12:10 PM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default using iif and like in control Source of report

Use * as the wildcard, so:
=IIf([YourFieldNameHere] Like "*bill*", "Yep", "Nah")

There is a serious problem with the field named Name. Most things in Access
(including reports) have a Name property, so Access is likely to mistake
your example and use the Name of the report instead of the contents of the
field named Name. Rename the field to CustomerName or somthing.

Before you do that, turn Name AutoCorrect off. Otherwise Access remembers
and still tries to match the original field name. More info on why you want
this off:
http://allenbrowne.com/bug-03.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Prohock" wrote in message
...
Simple question! I have a table that has a single field called [name]. I
want
my report to display true if a name matches "bill". For exam if the field
value is "bill Jan" or "Jan Bill" it would be true, "Jan Mark" would be
false. Something like this:

=IIf([Name] Like "&bill&","true","false")


 




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 11:35 AM.


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