Hello, I have what seems like it should be a fairly simple question, but am having problems for whatever reason. In an Access form, I have two list boxes, [Status] and [PendTo]. In the [Status] box, I have the options "Open", "Pending", and "Closed"; with "PersonA" and "PersonB" in [PendTo]. What I would like to know is how to make it where the [PendTo] list box is only visible if the [Status] is set to "Pending". What I have is something like this in the BeforeUpdate field of the PendTo list box ('StatusLB' is the name of the [Status] list box itself):
=IIf("StatusLB='Pending'","Me!Visible=True","Me!Vi sible=False")
But alas, it doesn't work. Am I making a simple syntax error or is it even possible to do this, or am I just completely off? Please help.
To answer your question, you're just completely off! Sorry, but you asked! Me.Visible controls the visibility of the entire form, not the PendTo listbox.
Also, any code in the PendTo_BeforeUpdate event won't fire until after something is selected from the PendTo listbox, so that isn't going to work for you, either.
Assuming that the listboxes are bound to fields in the underlying table/query, StatusLB has Multi-Select Property set to No and this is a Single View form, as opposed to a Datasheet or Continuous View form, this should do the job: - Private Sub StatusLB_AfterUpdate()
-
If Me.StatusLB = "Pending" Then
-
PendTo.Visible = True
-
Else
-
PendTo.Visible = False
-
End If
-
End Sub
-
-
Private Sub Form_Current()
-
If Me.StatusLB = "Pending" Then
-
PendTo.Visible = True
-
Else
-
PendTo.Visible = False
-
End If
-
End Sub
Welcome to Bytes!
Linq ;0)> 4 1676
To answer your question, you're just completely off! Sorry, but you asked! Me.Visible controls the visibility of the entire form, not the PendTo listbox.
Also, any code in the PendTo_BeforeUpdate event won't fire until after something is selected from the PendTo listbox, so that isn't going to work for you, either.
Assuming that the listboxes are bound to fields in the underlying table/query, StatusLB has Multi-Select Property set to No and this is a Single View form, as opposed to a Datasheet or Continuous View form, this should do the job: - Private Sub StatusLB_AfterUpdate()
-
If Me.StatusLB = "Pending" Then
-
PendTo.Visible = True
-
Else
-
PendTo.Visible = False
-
End If
-
End Sub
-
-
Private Sub Form_Current()
-
If Me.StatusLB = "Pending" Then
-
PendTo.Visible = True
-
Else
-
PendTo.Visible = False
-
End If
-
End Sub
Welcome to Bytes!
Linq ;0)>
It works! Oh thank you so much. I actually tried something close to each of those two subs at one point, but never thought of using them both together. It makes sense why you have to do it that way though. Thanks again.
Glad we could help!
Linq ;0)> NeoPa 32,556
Expert Mod 16PB
Just as an alternative (as I know Linq's code should work) I'll post : - Private Sub StatusLB_AfterUpdate()
-
Call PendToVis()
-
End Sub
-
-
Private Sub Form_Current()
-
Call PendToVis()
-
End Sub
-
-
Private PendToVis()
-
Me.PendTo.Visible = (Me.StatusLB = "Pending")
-
End Sub
I always recommend taking common code out into its own procedure, as an aide to avoiding potential problems later (if anything needs to be changed).
This is purely for the benefit of the OP as I know you wouldn't need to be told this Linq ;)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bart Lateur |
last post by:
In an Access form, I'd like to show the status on whether an item as
entered in a textbox (and thus in its coupled record field) exists in a
list in another table. I've tried:
- Making the...
|
by: Shannan Casteel via AccessMonster.com |
last post by:
I want to have a form with 40 PartNumber text boxes, 40 PartDescription text
boxes, and 40 PartPrice text boxes. The name of each would vary of course,
but I want to be able to enter the part...
|
by: djc |
last post by:
I have several subroutines (all inline code) that wind up using the same
database connection object variable. I have been declaring a new variable in
every sub. I just now came to a point where I...
|
by: lukster |
last post by:
Hello There,
I'm trying to create a view that has calculations dependent on
calculations, where the problem resides is that each time I make a
calculation I must create an intermediate view so I...
|
by: Dst |
last post by:
How can i make the selecteditem in a gridview visible ?
I have a gridview inside a panel which has a vertical scrollbar.
Is it possible to make it visible ?
Scroll down or something...
|
by: imranafsari |
last post by:
Dear All,
I am making web based application using asp.net and C#(VS2005) .
i have two questionn
1. how i can access menu item seleted in other web page using C#.
2.Based on the value in the text...
|
by: imran |
last post by:
Dear All,
I am developing web Application using asp.net and C#(VS2005).i want to know
how i can fetch menu item selected(which is desinged in master.aspx) on the
other C# page (welcome.aspx.cs).
|
by: sony.m.2007 |
last post by:
Hi,
I'm creating a combox control in XAML(WPF) and loading the items from
a table in sql server.
There are four items in the combobox.I need to hide an item in the
combobox and to show three...
|
by: WannabePrgmr |
last post by:
I am working in Access 2003 and have approximately 10 fields that I want to be able to query on.
The catch is that if I only fill in 3 or 4 fields, only the data that matches only those three fields...
|
by: amel86 |
last post by:
hello everybody,
i have a problem in my system related to list menu dependent.
i want a simple list menu dependent that when we select A, it show B, when select B it show C and so on.
If...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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: 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,...
|
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,...
| |