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.
No comments:
Post a Comment