?
Solved

Access Report - If Statement help

Posted on 2004-10-13
5
Medium Priority
?
1,675 Views
Last Modified: 2013-11-28
I have written an If statement to allow me to display (on a report) which box was selected on a Form:

=IIf(Forms![Main Menu]!OpenCheck=-1,"Open","") & IIf(Forms![Main Menu]!ClosedCheck=-1,"Closed","")

This currently displays 'Open', 'Closed', or 'OpenClosed'

I want it to display 'Open', 'Closed', or 'Open and Closed'

Please help.
Scotto13


0
Comment
Question by:Scotto13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 8

Assisted Solution

by:James Bendall
James Bendall earned 600 total points
ID: 12301115
How about:

=IIf(Forms![Main Menu]!OpenCheck=-1,IIf(Forms![Main Menu]!ClosedCheck=-1,"Open and Closed","Open"),"") & IIf(Forms![Main Menu]!ClosedCheck=-1,"Closed","")

Hope this helps

JB
0
 
LVL 85
ID: 12301121
This is probably more easily done in the Format of the section containing your control:

Sub Detail_Format()

Dim strShow As String

If Forms![Main Menu]!OpenCheck= True Then
  strShow = "Open"
End If

If Forms![Main Menu]!ClosedCheck= True Then
  If Len(strShow)=0 Then
    strShow = "Closed"
  Else
    strShow = strShow & " and Closed"
  End If
End If

Me.YourControlName = strShow

End Sub
0
 
LVL 15

Accepted Solution

by:
will_scarlet7 earned 400 total points
ID: 12301301
a small tweak to JB's suggestion:

=IIf(Forms![Main Menu]!OpenCheck=-1,"Open", "") & IIf(Forms![Main Menu]!ClosedCheck=-1,Iif(Forms![Main Menu]!OpenCheck=-1, " And Closed","Close"), "")
0
 

Author Comment

by:Scotto13
ID: 12301361
Thank you Will.  I was trying to edit JBs code but could not figure it out.  I'll split the points...
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12302452
Glad I could be a help.
God bless!

Sam
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question