IIF function

barretc

Registered User.
Local time
Today, 00:39
Joined
Jul 14, 2006
Messages
14
Hey,

I'm trying to get the output of checkboxes to be output as Yes (Ticked) or No (Unticked). As you know there are 0 and -1 (People are going to read this data so I want it to be meaningful).

I was going along the lines of:

IIF check_box = -1, "yes", "no"

I checked the Access help page, and all it stated was the meaning of the truestate and falsestate, didn't really offer much else.

If anyone could give me a hand, it'd be much appreciated.
 
I think this is what you want:

Code:
IIF(check_box = -1, "Yes", "No")

HTH
 
Private Function ReturnValue(ByVal yesInt As Integer) As String

ReturnValue = IIf(yesInt = -1, "Yes", "No")

End Function

Private Sub Check0_Click()

Dim myanswer As String

myanswer = ReturnValue(CInt(Check0.Value))
MsgBox myanswer

End Sub


This should work just fine.
 
Thank you both for your help. However, if I may ask valheru, could you please comment on the code? If you could, it would help me incorporate your code with what I already have.

Again, thanks.
 
Just set the display format of your textbox to Yes/No, no code is needed
 
Private Sub Command235_Click()
Dim strToWhom As String
Dim strMsgBody As String
Dim strSubject As String


strSubject = "Your Subject goes here!"
strToWhom = "email@email.com"


strMsgBody = "Account No: " & Account_No & Chr(10) & _
"Date: " & Date & Chr(10) & " " & "Customer Name: " & Customer_Name & Chr(10) & _
"Customer Username: " & Customer_User_Name & Chr(10) & " " & "Time: " & Time & Chr(10) & _
"Movie/TV Title: " & Movie_TV_Title & Chr(10) & " " & "File Name: " & File_Name & Chr(10) & _
"Issue: " & Issue & Chr(10) & _
"Adam CSR: " & Adam_CSR_Name & Chr(10) & _
"Email Address: " & Email_Address & Chr(10) & _
"Telephone No: " & Telephone_No & Chr(10) & _
"Date Received by Post Production: " & Date_Received_by_Post_Production & Chr(10) & _
"Credit Provided by Post Production: " & Credit_Provided_by_Post_Production & Chr(10) & _
"Accounts advised of Credit by Post Production: " & Accounts_Advised_of_Credit_By_PP & Chr(10) & _
"Comment: " & Comment & Chr(10) & _
"Date Received by Technical Support: " & Date_Received_by_Technical_Support & Chr(10) & _
"Credit Provided by Technical Support: " & Credit_Provided_by_Technical_Support & Chr(10) & _
"Accounts advised of Credit by Technical Support: " & Accounts_Advised_of_Credit_by_TS & Chr(10) & _
"Customer IP Address: " & Customer_IP_Address & Chr(10) & _
"Fault_No: " & Fault_No & Chr(10) & _
"Description: " & Description & Chr(10) & _
"Problem with Network: " & Problem_with_Network & Chr(10) & _
"Notes: " & Notes & Chr(10) & _
"Date received by RT customer service: " & Date_received_by_ReelTime_customer_service & Chr(10) & _
"Problem with the content: " & Problem_with_the_Content & Chr(10) & _
"Problem with ReelTime service: " & Problem_with_ReelTime_service & Chr(10) & _
"No Problem Identified: " & No_Problem_Identified & Chr(10) & _
"Issue Resolved: " & Issue_Resolved & Chr(10)

DoCmd.SendObject , , , strToWhom, strToCCWhom, , strSubject, strMsgBody, True

End Sub

------------------------------------------------------------------------

This copious amount of code does this when I push the button on the form.

booyah.JPG


------------------------------------------------------------------------

I want the circles in red to be turned to yes's or no's.
 
If you want to make it really confusing do this:
=IIF(check_box = -1, "Yes", IIF(check_box > -1, "No"," "))
This is cool when you need more that one answer. :)
 

Users who are viewing this thread

Back
Top Bottom