Solved

Access Report - If Statement help

Posted on 2004-10-13
5
1,666 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 150 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 84
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 100 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

732 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