I'm really new. I'm working in Access 2010. I did the following and my [Probation Ends:] is always invisible now. I have a Label Box that I changed to a Text Box. I set the Format for Visible to Yes and Can Shrink to Yes. The Control Source is [Probation Ends:] and that is the Name also. I added an Event as follows: - Private Sub Probation_Ends__Click()
-
-
If IsNull(Me![Probation End Date]) Then
-
Me![Probation Ends:].Visible = False
-
Else
-
Me![Probation Ends:].Visible = True
-
End If
-
-
End Sub
If the [Probation End Date] is null, then I want the [Probation Ends:] box to be invisible. What do you think is the problem?
Change the name of your textbox to be different than it Control Source. Then put your code (with the new control name) in the Detail section's OnFormat event.
14 1059
Try putting your code in the form's OnCurrent event.
This is a report. I don't see OnCurrent...
Change the name of your textbox to be different than it Control Source. Then put your code (with the new control name) in the Detail section's OnFormat event.
I changed the name to PE and I moved the event to "On Enter", but it still didn't work. I didn't see an OnFormat event on the Event tab. Here is the changed event... - Private Sub PE_Enter()
-
-
If (Me![Probation End Date]) = "" Then
-
Me!PE.Visible = True
-
Else
-
Me!PE.Visible = False
-
End If
-
-
End Sub
I had also changed the IsNull out and put = "". Didn't work...
You are looking the control's event list, not the report's detail section (or whatever section your textbox is in). Click on an empty space beside your textbox and then look at your event list. Also, you need to change the reference in your code to be Me.PE not Me.[Probation End Date].
I found it. I don't understand why all of the controls would be pointed to PE? It is only to print if the Probation End Date is empty.
Got it to work!!! Yea!! I don't use a VBA code. I just put the following in the Control Source line and use the Control Source Names, not the Names of the fields. - =IIf([PROBATION END DATE] Is Null,Null,"PROBATION ENDS:")
That doesn't hide the control, it just makes it so that there isn't anything in it. But if that is all you need then great.
NeoPa 32,556
Expert Mod 16PB
I've changed the post selected as Best Answer for a number of reasons. Not least of which is that it actually answers the question posed - rather than simply providing a way round the issue.
NeoPa 32,556
Expert Mod 16PB
As a tip, you can also simplify the code greatly : - Private Sub Detail_Format()
-
Me.[Probation Ends:].Visible = Not IsNull(Me.[Probation End Date])
-
End Sub
I tried adding the code and it wouldn't work. Seth's didn't work either.
Based on the code that you provided, you didn't try exactly what I had said as it wasn't in the report detail section's OnFormat event.
NeoPa 32,556
Expert Mod 16PB LadyScot:
Seth's didn't work either.
I can confirm that Seth's suggestion itself does work. I can't say why it was that it didn't work for you as I can't see exactly what it was that you tried. It does seem clear, however, that it wasn't exactly as he suggested.
There are a number of reasons why it might not work for you - from all VBA code being disabled due to security restrictions to your placing the code in the wrong container (module), or even not setting the event property up correctly to access the code.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Gabriël |
last post by:
Hi All,
I've created an eventhandler for ItemdataBound and ItemCreated, but when I
access "e.Item.Cells.Text" it's always empty. BUT, when I assign a value
to this empty field (while being in...
|
by: Paul J. Lucas |
last post by:
I have a simple form that contains an INPUT element that has an
initial value.
<form name="Form">
<input name="Number" type="text" value="Hello">
</form>
When the form loads, I want all of...
|
by: jfilan |
last post by:
index.php?action=searchresults&pclass=1
index.php?action=searchresults&pclass=2
index.php?action=searchresults&pclass=3
index.php?action=searchresults&pclass=4...
|
by: Ste |
last post by:
Hi there,
I've got a website with a list of Frequently Asked Questions, so
there's a question and answer in a long list down the page.
Can anyone recommend a simple script that would allow me...
|
by: medim84 |
last post by:
How to format text in memo field for predefine text, using - default value - expression builder? For e.g. new row, bold text, font size…
Thanks
|
by: elastreto |
last post by:
Hello,
I have been trying, so far in vain, to hide the label and text control in a form when the text control is empty/null.
I have looked at past postings and tried the code below, however I...
|
by: Academia |
last post by:
I let the use modify the text of a combobox and then I replace the selected
item with the new text (in Keyup event).
But if he sets the Text property to an empty string ("") that sets the...
|
by: SWATI AGARWAL |
last post by:
How can we set the size of a button in java when the text on it is empty.
setbounds ,setsize ,setprefferedsize are the options that i tried but i failed to get the desired output.
|
by: ammar yasir |
last post by:
how to justify text in memo field of a form and a report? i need some sort of code that keeps the text in memo field justified. there are only 3 options of text align, right,left, distributed. i want...
|
by: CD Tom |
last post by:
I have a customer in the Netherlands that is getting the following error "Text file specification Field separator matches decimal separator or text delimiter" This happens when I try and run the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |