A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Drop down list



 
 
Thread Tools Display Modes
  #1  
Old March 31st, 2009, 08:20 PM posted to microsoft.public.access.forms
Mya48
external usenet poster
 
Posts: 27
Default Drop down list

In my form I have a drop down lists that lists all the office supply
products. My question is: How do I get the drop down lists to display only
those products which have not been discontinued? In my main table their is a
yes/no field if a product has been dicontinued. Thanks.
  #2  
Old March 31st, 2009, 09:14 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Drop down list

Base your drop-down list on a query that only finds the products not
discounted.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Mya48" wrote in message
...
In my form I have a drop down lists that lists all the office supply
products. My question is: How do I get the drop down lists to display
only
those products which have not been discontinued? In my main table their is
a
yes/no field if a product has been dicontinued. Thanks.



  #3  
Old March 31st, 2009, 09:50 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default Drop down list

Something like:

SELECT ProductsTable.ProductID, ProductsTable.ProductName, ProductsTable.
Discontinued
FROM ProductsTable
WHERE (((ProductsTable.Discontinued)=0));

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

  #4  
Old March 31st, 2009, 11:33 PM posted to microsoft.public.access.forms
Mya48
external usenet poster
 
Posts: 27
Default Drop down list

Thank you very much, it works great.

"Linq Adams via AccessMonster.com" wrote:

Something like:

SELECT ProductsTable.ProductID, ProductsTable.ProductName, ProductsTable.
Discontinued
FROM ProductsTable
WHERE (((ProductsTable.Discontinued)=0));

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com


  #5  
Old March 31st, 2009, 11:58 PM posted to microsoft.public.access.forms
Mya48
external usenet poster
 
Posts: 27
Default Drop down list

Sorry to bother you again but would this work on a report as well?

"Linq Adams via AccessMonster.com" wrote:

Something like:

SELECT ProductsTable.ProductID, ProductsTable.ProductName, ProductsTable.
Discontinued
FROM ProductsTable
WHERE (((ProductsTable.Discontinued)=0));

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com


  #6  
Old April 1st, 2009, 01:04 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Drop down list

On Tue, 31 Mar 2009 15:58:01 -0700, Mya48
wrote:

Sorry to bother you again but would this work on a report as well?


Yep. Just try it g
--

John W. Vinson [MVP]
  #7  
Old April 1st, 2009, 10:18 PM posted to microsoft.public.access.forms
Mya48
external usenet poster
 
Posts: 27
Default Drop down list

I entered this into the code but it doesn't do anything, any suggestions?

Private Sub Report_Open(Cancel As Integer)

On Error Resume Next
Me![ProductName].Controls = Me![ProductName]
Me.[ProductName].Object = Not (((Products.Discontinued) = 0))

End Sub

"John W. Vinson" wrote:

On Tue, 31 Mar 2009 15:58:01 -0700, Mya48
wrote:

Sorry to bother you again but would this work on a report as well?


Yep. Just try it g
--

John W. Vinson [MVP]

  #8  
Old April 2nd, 2009, 12:44 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Drop down list

On Wed, 1 Apr 2009 14:18:15 -0700, Mya48
wrote:

I entered this into the code but it doesn't do anything, any suggestions?

Private Sub Report_Open(Cancel As Integer)

On Error Resume Next
Me![ProductName].Controls = Me![ProductName]
Me.[ProductName].Object = Not (((Products.Discontinued) = 0))


This has absolutely NO relationship to anything I've seen in the thread, and
it doesn't make any sense to me. The Controls collection is a collection of
the controls (textboxes, combos, etc.) on a Form or Report.

What is this code intended to accomplish?
--

John W. Vinson [MVP]
  #9  
Old April 2nd, 2009, 03:28 PM posted to microsoft.public.access.forms
Mya48
external usenet poster
 
Posts: 27
Default Drop down list

All I was trying to accomplish was for my report to show only the products
that are available not discontinued. You gave me this code for the form and
it works great.

SELECT ProductsTable.ProductID, ProductsTable.ProductName, ProductsTable.
Discontinued
FROM ProductsTable
WHERE (((ProductsTable.Discontinued)=0));


but I guess I don't know where to put it on the report because there is no
row source on the properties of the field like there is on the form.

"John W. Vinson" wrote:

On Wed, 1 Apr 2009 14:18:15 -0700, Mya48
wrote:

I entered this into the code but it doesn't do anything, any suggestions?

Private Sub Report_Open(Cancel As Integer)

On Error Resume Next
Me![ProductName].Controls = Me![ProductName]
Me.[ProductName].Object = Not (((Products.Discontinued) = 0))


This has absolutely NO relationship to anything I've seen in the thread, and
it doesn't make any sense to me. The Controls collection is a collection of
the controls (textboxes, combos, etc.) on a Form or Report.

What is this code intended to accomplish?
--

John W. Vinson [MVP]

  #10  
Old April 2nd, 2009, 04:57 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Drop down list

On Thu, 2 Apr 2009 07:28:01 -0700, Mya48
wrote:

All I was trying to accomplish was for my report to show only the products
that are available not discontinued. You gave me this code for the form and
it works great.

SELECT ProductsTable.ProductID, ProductsTable.ProductName, ProductsTable.
Discontinued
FROM ProductsTable
WHERE (((ProductsTable.Discontinued)=0));


but I guess I don't know where to put it on the report because there is no
row source on the properties of the field like there is on the form.


Use the same Query *As the recordsource for the Report*.

This has nothing to do with the properties of a field or of a control. My
suggestion is to change where the report gets its data.
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:44 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.