473,383 Members | 1,919 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,383 software developers and data experts.

How to make a checkbox hide a field in subform on a tab control

547 512MB
I have been struggling for 4 hours now with this. When i click the checkbox, it is suppose to hide a specific field [NPItemtype] in a subform [NPCaptOtherSF] which is situated on a tab control with other subforms
(columns = option group for checkbox)
i have tried the following:
Expand|Select|Wrap|Line Numbers
  1. If Forms![fis_npcaptureF]![Columns] = 1 Then [Forms]![fis_npcaptureF]![NPCaptOtherSF]![NPItemtype].ColumnHidden = True
  2. else
  3. [Forms]![fis_npcaptureF]![NPCaptOtherSF]![NPItemtype].ColumnHidden = False
  4.  
also tried
Expand|Select|Wrap|Line Numbers
  1. If Forms![fis_npcaptureF]![Columns] = 1 Then [Forms]![fis_npcaptureF]![NPCaptOtherSF]![NPItemtype].visible = false
  2. else
  3. [Forms]![fis_npcaptureF]![NPCaptOtherSF]![NPItemtype].visible = True
I am not sure whether it is the Tab control affecting it.
Please be so kind to assist.
Apr 21 '12 #1

✓ answered by NeoPa

To start with, all references should be relative to the Me reference.

For the basic information from which you should be able to determine this for yourself, see Referring to Items on a Sub-Form.

I'll assume, from what's in your question, that the following is an accurate description of what you're working with :
  • Name of main form = [fis_npcaptureF].
  • Name of CheckBox control = UNKNOWN. I will refer to it for now as [chkVis].
  • Name of option group in which [chkVis] seems to have a value of 1 = [columns].
  • Name of Tab (or Page) control = UNKNOWN. Also irrelevant so I will not refer to it at all.
  • Name of the subform control on the Tab (or Page) = [NPCaptOtherSF].
  • Name of control on the form, within the subform control, that you intend to show/hide = [NPItemtype].

Unfortunately, I have no info as to whether or not anything is bound, so I will assume for now that it is. An unbound form would not require a Form_Current() event procedure.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     Call ShowHide()
  3. End Sub
  4.  
  5. Private Sub columns_AfterUpdate()
  6.     Call ShowHide()
  7. End Sub
  8.  
  9. Private Sub ShowHide()
  10.     With Me
  11.         .NPCaptOtherSF!NPItemtype.Visible = Not .chkVis
  12.     End With
  13. End Sum

1 3061
NeoPa
32,556 Expert Mod 16PB
To start with, all references should be relative to the Me reference.

For the basic information from which you should be able to determine this for yourself, see Referring to Items on a Sub-Form.

I'll assume, from what's in your question, that the following is an accurate description of what you're working with :
  • Name of main form = [fis_npcaptureF].
  • Name of CheckBox control = UNKNOWN. I will refer to it for now as [chkVis].
  • Name of option group in which [chkVis] seems to have a value of 1 = [columns].
  • Name of Tab (or Page) control = UNKNOWN. Also irrelevant so I will not refer to it at all.
  • Name of the subform control on the Tab (or Page) = [NPCaptOtherSF].
  • Name of control on the form, within the subform control, that you intend to show/hide = [NPItemtype].

Unfortunately, I have no info as to whether or not anything is bound, so I will assume for now that it is. An unbound form would not require a Form_Current() event procedure.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     Call ShowHide()
  3. End Sub
  4.  
  5. Private Sub columns_AfterUpdate()
  6.     Call ShowHide()
  7. End Sub
  8.  
  9. Private Sub ShowHide()
  10.     With Me
  11.         .NPCaptOtherSF!NPItemtype.Visible = Not .chkVis
  12.     End With
  13. End Sum
Apr 21 '12 #2

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

Similar topics

0
by: Sabine Oebbecke | last post by:
Hi Experts! I have several forms and reports where controls get their values with 'Forms!MainForm!Control' or 'Forms!MainForm!Subform!Control' resp 'Forms!MainForm!Subform.Form!Control' which...
12
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course,...
10
by: Sally | last post by:
When I click on a control in a subform, what is the syntax to return the name of the subform control on the main form that contains the subform? MsgBox "MySubform is in " & < ???? > Thanks, ...
4
by: MLH | last post by:
I have a subform control on a mainform. Each time I do anything experimentally with it - like even change its Width property, A97 takes the liberty of setting values in the link child field and...
6
by: MLH | last post by:
When the vehicle entry form (frmVehicleEntryForm) first opens, the additional owner SubForm control (frmAddnlOwnrListSubForm) is enabled. You can click on it and it will accept the focus. But after...
1
by: MLH | last post by:
I have a form with a subform control on it listing records returned by a saved query named UnbilledVehicles. I would like to put command buttons on the main form to apply dynamic filters to the...
8
by: kevin.vaughan | last post by:
Good Afternoon Everyone, Could someone please explain why I can't set the Subform control Visible attribute to False as below? The statement for the locked attributes work but not for the...
3
by: ApexData | last post by:
I am using the Shortcut Menu Bar property of many combobox controls to execute a single shared custom function. When the function executes, I need it to immediately identify the following items:...
1
by: veteranwebdesign | last post by:
Hello, I have a main form. I want forms to open in a subform control box. What is the code for the option group to open the subforms in the control box. I didn't create subforms, I created...
4
by: MLH | last post by:
If I have a main form - Form3 - with a subform control named SF4 and they are NOT linked on any common field (no child or master field links) - can I write code on Form3 to filter the records...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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 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.