473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Hide Checkbox if textbox is null

21
Hi There,
Need some help, on Access Reports if the text box is null is there a code which will hide the checkbox?
Jun 24 '08 #1
6 9673
Well the easist way is probably to put
Expand|Select|Wrap|Line Numbers
  1. if isnull(mytestfield) then
  2. mychkbox.visible = false
  3. else 
  4. mychkbox.visible = true
  5. end if
  6.  
This code could go on the "oncurrent" for the form or preferrably the "afterupdate" for the text box. The reason one is preferable to the other is the oncurrent runs ALOT and the other only happens when a user modifies and leaves the text box.
Jun 24 '08 #2
Marks
21
Thanks Carl,
However wouldn't this still show still as a Report?

Cheers

Well the easist way is probably to put
Expand|Select|Wrap|Line Numbers
  1. if isnull(mytestfield) then
  2. mychkbox.visible = false
  3. else 
  4. mychkbox.visible = true
  5. end if
  6.  
This code could go on the "oncurrent" for the form or preferrably the "afterupdate" for the text box. The reason one is preferable to the other is the oncurrent runs ALOT and the other only happens when a user modifies and leaves the text box.
Jun 24 '08 #3
missinglinq
3,532 Expert 2GB
Carl's code is correct, but he didn't pay enough attention to the question! To do this in a Report it needs to go in the Detail_Format event of the Report.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2. If IsNull(mytestfield) Then
  3.   mychkbox.Visible = False
  4. Else
  5.   mychkbox.Visible = True
  6. End If
  7. End Sub
  8.  
Linq ;0)>
Jun 24 '08 #4
MMcCarthy
14,534 Expert Mod 8TB
Also using the can shrink property on the control will reduce the amount of white space used in the report.
Jun 25 '08 #5
Carl's code is correct, but he didn't pay enough attention to the question! To do this in a Report it needs to go in the Detail_Format event of the Report.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2. If IsNull(mytestfield) Then
  3.   mychkbox.Visible = False
  4. Else
  5.   mychkbox.Visible = True
  6. End If
  7. End Sub
  8.  
Linq ;0)>
DARNIT. I always seem to be doing that. Sorry.
Jun 30 '08 #6
missinglinq
3,532 Expert 2GB
Detail! Detail!

;0)>
Jun 30 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
5
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add...
4
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
4
by: Wayne Wengert | last post by:
I have a datagrid bound to dataset where some entries are null. In that grid I am defining a column as Boolean (see code below) and I get the expected checkbox which is checked or unchecked when...
2
by: UJ | last post by:
Is there a way with a asp:checkbox to run a JavaScript to display/hide text/input on the screen without doing a postback? I also need to be able to access the stuff at the server so I need to...
1
by: asilverpeach | last post by:
Hey Guys! Found some great scripts here on this topic but have to make to changes to the code that I can't seem to figure out. First, In the following code clicking on the headers shows the...
2
by: JLC | last post by:
Hi, I am creating a page in asp.net that has a checkbox and a textbox. When the checkbox is checked I want the textbox to become active and show text. If the checkbox is unchecked, I would like...
0
Frinavale
by: Frinavale | last post by:
This code snippet is just a little bit of fun. It demonstrates how you use JavaScript and CSS to show or hide columns in a table depending on whether or not a checkbox corresponding with the...
1
by: janetb | last post by:
I have a gridview with an update capabilities - a textbox column (roomName), a dropdownlist(orgID), a dropdownlist(roomTypeID),a checkbox column (dialOut), a checkbox column (dialIn). When I try to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.