473,396 Members | 2,151 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,396 software developers and data experts.

Cannot get form to show field based on value of another field

I have created a inventory tracking database and I want to show/hide certain fields based on the device category. The deviceCategory field is a lookup field to a table that lists all the different type of devices to include PC, Printer, Network....

I want it so that when you select a certain category device you get the fields related to the device. For example if you get PC I want to show the fields for Model, Service Tag, RAM, ....

For testing Im only working with showing the model field. I currently have the model field visible set to "No" and then in the deviceCategory I set an afterUpdate event to

Expand|Select|Wrap|Line Numbers
  1. Private Sub test_AfterUpdate()
  2. If deviceCategory = "test" Then
  3. deviceModel.Visable = True
  4. End Sub
According to http://bytes.com/topic/access/answers/854100-how-do-i-hide-form-field-only-show-based-value-another-form-field it should work. What am I doing wrong? Thanks!
Mar 24 '10 #1
3 3514
missinglinq
3,532 Expert 2GB
You have your code in the AfterUpdate event of a Control named test and you have no End If. It needs to be in the deviceCategory_AfterUpdate event, and really should read:
Expand|Select|Wrap|Line Numbers
  1. Private Sub deviceCategory_AfterUpdate()
  2.  If Me.deviceCategory = "test" Then
  3.    deviceModel.Visable = True
  4.  End If
  5. End Sub
  6.  

Welcome to Bytes!

Linq ;0)>
Mar 24 '10 #2
thank you for the reply. My original post had the wrong info from my test db. I corrected it as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Category_AfterUpdate()
  2. If Me.Category = "Laptop" Then
  3.  Model.Visible = True
  4. End If
  5. End Sub
OK, it is working when I have the Category set up as a text field. However, category is a drop down list from which to select the value. How do I get it to update this way? When I have a drop down list it does not work w/ afterUpdate?

Also, it appears that when Laptop is listed in Category it now shows the Model field over every record. I want it to only show on the records for which category is listed as laptop, still hide on all other records.
Mar 29 '10 #3
NeoPa
32,556 Expert Mod 16PB
@BobbyD1120
See Why Values in Unbound Form Controls do not Persist for why that won't work. You would need to look at creating the condition in the underlying record source. Even then I doubt you could hide the control exactly.
Mar 29 '10 #4

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

Similar topics

2
by: JJ | last post by:
Hi All, When someone selects a value in a select on a form I want to show the same form with another select with certain values depending on first select. How can I do this? Should I keep...
5
by: Raffi | last post by:
Hi folks, I'm new to JavaScript and need some help. I have a form with a select field. Depending on what is selected in this field, I want to display or not display another select field. For...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
4
by: Koen | last post by:
Hi all, At work I created a database which is really helpful. The database is used by approx 15 users. Everything worked great, until I added some 'scoreboard' forms and reports. I get the...
9
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a main form with a continuous subform. On the main form I have a text field called . It gets populated based on what the user selects in a field on the...
6
by: sheree | last post by:
I would like to create a query where one of the columns of the queries comes from a combo list box on a form. For example, if my table has the following fields: id name interest1 interest2...
4
by: Krzysztof Bartosiewicz | last post by:
Hi! I haven't been using Access for a very long time and I forgot everything :) I will be very greatful for help since I have been fighting with this problem for a few hours... I have three...
1
by: meganrobertson22 | last post by:
hi everybody- what is the best way to add data from one form to another? i have 2 tables: person and contract. here are some of the fields. table: person personid (autonumber and primary...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
3
by: steveninfl | last post by:
Hello , I am using MS Access 2000. I have a Table called Transactions, I have created a form for this table, one of the fields on the form is a combo box with the row source type as value list. In...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

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.