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

How do I hide a form field and only show it based on the value of another form field?

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 this combo box field that I call "Transaction type" the user must select a value from the drop down list.

What I want to do is based on the selection of the "Transaction type" field, if the user should select a transaction type of ADHOC or EMERGENCY or CCB CR. I would like another field I have created as a text box called "CHANGE REQUEST #" to show on the form. If they select an of the other transaction other then the ADHOC or EMERGENCY or CCB CR then I do now want the "CHANGE REQUEST #" text box field to show on the form. ??

Is this possible to do ?
Please advise..
Thank you.
Nov 14 '08 #1
3 24508
Should be.
Set the 'visible' property of the CHANGE REQUEST # control to No.
Then on the 'OnChange' value of the 'Transaction Type' combo box try the following:

Expand|Select|Wrap|Line Numbers
  1. If Me.Transaction_type = "ADHOC" Or _
  2.     Me.Transaction_type = "EMERGENCY" Or _
  3.     Me.Transaction_type = "CCB CR" Then
  4. Me.CHANGE_REQUEST_#.Visible = True
  5. Else
  6. Me.CHANGE_REQUEST_#.Visible = False
  7. End If
You might need to edit the control names slightly, I copied what you posted and added _ where there was a space (cos I think that's what Access does).

Lemme know if it works. x
Nov 14 '08 #2
Thank you so much for this response so quickly. I assume I am going to choose code builder and when I get the MS Visuual Basic box I copy and past what you have below, however can I ask the name after the Me. is that the text box Name or the Control Source name of the text box? I'm asking because it's not liking what I have in the Me.CHANGE_REQUEST_# part of the below statement.

I'm getting an error saying Compile Error : Method or Data member not found.
and it will highlight the CHANGE_REQUEST_# ??? I'm guessing I'm not using the correct name for that text box?? I'm very new at all this and I really appreciate your help.
Steve

If Me.Transaction_type = "ADHOC" Or _
Me.Transaction_type = "EMERGENCY" Or _
Me.Transaction_type = "CCB CR" Then
Me.CHANGE_REQUEST_#.Visible = True
Else
Me.CHANGE_REQUEST_#.Visible = False
End If
Nov 14 '08 #3
missinglinq
3,532 Expert 2GB
Before you go any further here, I'd change the name of

CHANGE_REQUEST_#

to something like

CHANGE_REQUEST_No

or

CHANGE_REQUEST_Number

The pound sign (#) is used as a delimiter in VBA to let Access know that what lies between two of them represents a date. It may be what's causing the problem with

Expand|Select|Wrap|Line Numbers
  1. If Me.Transaction_type = "ADHOC" Or _
  2. Me.Transaction_type = "EMERGENCY" Or _
  3. Me.Transaction_type = "CCB CR" Then
  4. Me.CHANGE_REQUEST_#.Visible = True
  5. Else
  6. Me.CHANGE_REQUEST_#.Visible = False
  7. End If     
Access may very well be considering

#.Visible = TrueElseMe.CHANGE_REQUEST_#

to be a date, and is unable to interpret it, hence the error. It's sure to cause you trouble, sooner or later.

Welcome to Bytes!

Linq ;0)>
Nov 15 '08 #4

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

Similar topics

6
by: Steve Speirs | last post by:
Hi I'm trying to show/hide a simple piece of text and a text field on a form based on what choice is made from a drop down box. <select name="dropdown" size="1"> <option selected...
2
by: Xerxes | last post by:
Hi, can you tell me how I can make a <label> hidden? I have hidden the field after the label: var M_Hide = isNS4?'hide':'hidden'; var M_Show = isNS4?'show':'visible'; ..... <label...
9
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
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...
3
by: | last post by:
I'm using the DataList and GridView controls, and I am trying to wrap my head around the problem of conditionally showing or hiding cells/cell content based on the presence or absence of DB data. I...
3
by: toodi4 | last post by:
I'm using a javascript that hides and unhides text based on a button click. It works great across static fields on a form. The problem I have is that I'm trying to hide and unhide various fields...
3
by: PowerLifter1450 | last post by:
Hi all, I have to Combo boxes on a form. The first one I would always like users to see. The second, however, I would like hidden if the first box has certain values selected. So, if ComboBox1 has...
1
by: nithingujjar | last post by:
Hi, I need to to hide a field"addr_state1" based on a value in the drop down list field called "addr_country".i.e.,if addr_country.value=="in" then hide addr_state1 else , and if the value in the...
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:
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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.