Share via

Make fields invisible on access form using visible VBA code

Anonymous
2014-08-29T16:48:39+00:00

I am using the code belore for my Event Procedure for after update; however, my fields are staying visible.  Did I miss a step?

Please advise.

If Me.Average_Effluent_Biological_Oxygen_Demand__BOD5_ = "0" Then

Me.Average_Effluent_Biological_Oxygen_Demand__BOD5_.Visible = False

Else

Me.Average_Effluent_Biological_Oxygen_Demand__BOD5_.Visible = True

End If

If Me.Average_Influent_Biological_Oxygen_Demand__BOD5_ = "0" Then

Me.Average_Influent_Biological_Oxygen_Demand__BOD5_.Visible = False

Else

Me.Average_Influent_Biological_Oxygen_Demand__BOD5_.Visible = True

End If

If Me.Fixed_Film_Trickle_Filtration_Process = "0" Then

Me.Fixed_Film_Trickle_Filtration_Process.Visible = False

Else

Me.Fixed_Film_Trickle_Filtration_Process.Visible = True

End If

If Me.Plant_Design_Flow_Rate = "0" Then

Me.Plant_Design_Flow_Rate.Visible = False

Else

Me.Plant_Design_Flow_Rate.Visible = True

End If

If Me.Nutrient_Removal = "0" Then

Me.Nutrient_Removal.Visible = False

Else

Me.Nutrient_Removal.Visible = True

End If

If Me.Location_of_Pool = "0" Then

Me.Location_of_Pool.Visible = False

Else

Me.Location_of_Pool.Visible = True

End If

If Me.Approximate_Pool_Size = "0" Then

Me.Approximate_Pool_Size.Visible = False

Else

Me.Approximate_Pool_Size.Visible = True

End If

If Me.Months_in_Use = 0 Then

Me.Months_in_Use.Visible = False

Else

Me.Months_in_Use.Visible = True

End If

Me.ID.Visible = False

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Duane Hookom 26,825 Reputation points Volunteer Moderator
2014-08-29T16:55:30+00:00

Your form is single view right?

Are most of the values actually text? If not use 0 rather than "0".

This type of code might also be needed in the On Current event of the form.

You can also typically change your 5 lines of code to one like:

If Me.Months_in_Use = 0 Then

Me.Months_in_Use.Visible = False

Else

Me.Months_in_Use.Visible = True

End If

TO:

Me.Months_in_Use.Visible = Me.Months_in_Use <> 0

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful