Solved

Visual Basic code make text box visible or not visible

Posted on 2013-01-29
4
892 Views
Last Modified: 2013-01-30
I have two text fields on my access report. If the RUNSUM has a number greater than 3, then I need to have CLSHOW not visible.

I wrote this in the code, but it does not seem to be working

Private Sub IiF()
If Me.RUNSUM > 3 Then
Me.CLSHOW.Visible = False
Else
Me.CLSHOW.Visible = True
End If
End Sub

What am I doing wrong?
0
Comment
Question by:joylene6
  • 2
4 Comments
 
LVL 39

Expert Comment

by:als315
ID: 38833873
Where you call function? It should be in On Format event. Result will be visible only in print or print preview, not in report view.
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 38833896
You should be using the OnFormat event of one of the sections in your report such as the Detail section:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.CLSHOW.Visible  = (Me.RUNSUM <= 3)
End Sub

Open in new window

0
 
LVL 1

Author Comment

by:joylene6
ID: 38835424
That worked!! thanks
0
 
LVL 1

Author Closing Comment

by:joylene6
ID: 38835428
Thanks you
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question