English is not my native language and it's really hard to explain what's going on there. I only have learnt it over the years I'm playing with Access.
I hope someone else pop in and explain it.
For now:
Since the code is running in a form's module, I never use
Me before controls name. I may be wrong but it makes the code simpler to read.
It means that I use
Mdid instead of
Me.Mdid.
image1.Visible =
Left part of the equal sign is used to set the property.
image1.Visible = means I want to set a value for the visibility of image1.
In the right side I have a function to return a False Or True.
InStr("ABC123,DEF123,GHI123,", Mdid & ",") > 0
InStr function checks the position of the first occurrence of one string within another.
I'm asking Instr to see if the position of
Mdid & "," in
"ABC123,DEF123,GHI123," is greater than 0 or not.
If instr returns 0, it means that
Mdid & "," can not be found in
"ABC123,DEF123,GHI123,"
This causes the right side of the equal sign to return a False value.
And
image1.Visible = Flase
Otherwise
If instr returns a number greater than 0, it means that
Mdid & "," can be found in
"ABC123,DEF123,GHI123,"
This causes the right side of the equal sign to return a True value.
And
image1.Visible = True
Note : The
, before and after Mdid is added just to be certain for an exact check and prevent error if Mdid is empty or null