Access: how to use a checkbox to control whether to display a message in another cell - ms-access

I have a Access form with multiple columns. One of column is a text column called "LASTNAME", and I would like to add one checkbox column to control whether this "LASTNAME" displayed or not.
For example,
|---------|-----------|
| Yes/No | Mark |
|---------|-----------|
If checkbox is selected or "Yes", then "Mark" will be displayed, otherwise, "Mark" will not be displayed in my report.
What is the proper way to do that?
Thanks

Related

MS Access: Why is my combo box displaying the wrong value?

I have 2 columns that populate my combo box. They come from a table where I manually wrote in an ID and a clean_value field.
The goal:
Display both columns on a combo box on a form. The ID values should be on the left of the clean_value values when looking at the drop down list. When selecting something in the list, the combo box should display the clean_value, not the ID. When saving the form, the form should write the ID value to a different table.
What I've tried:
I set up the table to get the values from. I set up the combo box to show the 2 values in the correct orientation. The ID value is the value that is being written to the table.
The problem: When the user selects one of the values in the list, their selection shows the ID. I want to display the clean_value upon selection instead. How do I do this?
I found a way to do this. I grabbed the clean_value field, the ID field, then the clean_value field again in the row source, then I just set the width of the first clean_value field to 0.021".

Access 2007 reports, hiding fields?

I have a report in Access 2007 thats populated with data from SQL SERVER (running on a vb6 application). This report has two subreports that display data. The first Subreport has a Label, "CHILDREN" and the subreport next to it displays Names of children. The 2nd subreport has a Label "PETS" and the subreport next to it displays PetName, and TypeOfPet. In most cases there are pets in every family, however, for some clients, there are no pets. What I'm trying to do is make the label PETS invisible if there are no pets, so the Label is not on the report by itself. How would I go about doing that?? Is this something I have to code?
The following link shows how to hide the label if no data: https://forums.techguy.org/threads/solved-access-2003-hide-field-labels-on-reports-when-value-is-null.660825/
Below are the steps required:
1. Delete the label from the text box.
2. Add new text box in place of the old label.
3. Format the new text box same as other label.
4. Set it's "Can Shrink" property to "Yes".
5.Bind the 'new' label to an expression that will solve to "" if the [Pet] field is blank or to the text string "Pets:" if the [Pet] field is not blank.
6. Change text box Control Source field on the Data tab of the Properties window. In it put:
iif(isnull([Pet]),"","Pets:")
This will put a zero-length string into the text box when the [Pet] field is null and the text "Pet:" when it is not null
7. If the field is blank, it could be null or a zero-length string (""), or could have any number of blank spaces in it. Rather than use "IsNull", use a combination of functions that will solve. i.e.:
Iif(trim(nz([Pet],""))="","","Pets:")

MS ACCESS Multiple Record Visibility If Statement

I am building a form in Access 2013 and I will print out 4 fields for each record.
So Let's say the form processes 2 records it will print out:
Field 1 Field 2 Field 3 Field 4
Field 1 Field 2 Field 3 Field 4
Now I want to have it when it displays Other to print out the description of the other from a table. To do this I want the field named DefectType to go invisible and then the Other field to become visible. I start with Other being invisible and DefectType Visible and place them on top of each other. Here is the VBA:
If DefectType <> "Other" Then
DefectType.Visible = True
Other.Visible = False
Else
DefectType.Visible = False
Other.Visible = True
End If
It works fine if they are all other because what it does it takes the first record value of Other and applies it to all the other records for that field.
So if the first record that is displayed has a field 3 and it has a value of Other it will then look for the value in the table that is under the "other" field and display the content. SO lets say the "other" content was lamination. Instead of showing Other it will make that DefectType field invisible and show the "Other" field which will show Lamination.
The problem is it then does this for the rest of the records. It won't test to see if the field 3 is "Other" or not, it will just assume and then put it's "Other" field contents for the subsequent records. This means that since some actually already have values in them, like Corrosion, and nothing in the "other" field it will display a blank box.
I want it to test each field 3 as it is displayed so it can tell if "other" is in the field or not.
I'm unsure how well I understand your question, but it sounds to me that your form includes 2 text boxes named DefectType and Other. When the value of DefectType is "Other", you want to display the value from the Other text box. But when the value of DefectType is anything else, you want to display the value of DefectType.
If that is correct, you can create a new text box named txtSummary and use this as its Control Source property.
=IIf([DefectType] = "Other", [Other], [DefectType])
The txtSummary text box would not be editable. To change its value, you would change the values in DefectType and/or Other.
That approach will ensure txtSummary is always updated based on the current values of DefectType and Other in the same record. And it will do that for each record in the form, including when the form is in Continuous Form or DataSheet View.
Your original approach would do what I think you want only when the form is in Single Form view.

Setting a default TEXT value to a combobox bound to a numeric value

Seemingly trivial question but I can't seem to get this working no matter what I try.
A typical use case is when I want the default text to describe the combobox field, e.g. "Select an item", but the combobox is referencing a table, bound to the ID column but displaying the name of the item.
Another case is when I have a default value I am not sure won't be null and would like to display something in case it is null.
I can set the value of the combobox to a text value, but nothing shows up. Referencing the value does give me back the text value I originally set it to, so it is purely a display issue.
Anyone know how I might resolve this?
Not necessarily the "cleanest" solution but you can add a record on your table that is bound and set that as your default value
e.g.
ID Value
-- -----
1 "Select Item"
2 "Item 1"
3 "Item 2"

Hide Column based up Parameter Selected SSRS

I would like to set the visibility of columns based upon the value selected in a parameter.
The problem is I do not want a specific parameter to do this (i.e Hide column X True/False)
My report has several different "departments" who are only interested in certain columns.
What would be the syntax for example to hide the "Sales" column when the "Customer Care" parameter is set?
you can do these works step by step:
1- press right click of your mouse in your favorite column
2- select column visibility
3- from opened window select "Show or hide based on an expression" radio button
4- set an expression for hidden state. for example:
=IIF(Parameters!CustomerCare.Value <> "favorite value", true,false)