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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Passing value to Query Criteria from a ListBox



 
 
Thread Tools Display Modes
  #1  
Old July 15th, 2008, 02:05 PM posted to microsoft.public.access.queries
Atif
external usenet poster
 
Posts: 45
Default Passing value to Query Criteria from a ListBox

I am using Access 2007.

Presently I am using a Command Button to call a Macro which opens a Query in
Pivot Chart view.

Now I want to use a ListBox which has these options NAE, NAW and EU. How can
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.
  #2  
Old July 15th, 2008, 03:44 PM posted to microsoft.public.access.queries
bhicks11 via AccessMonster.com
external usenet poster
 
Posts: 529
Default Passing value to Query Criteria from a ListBox

Make the criteria for that field equal to the listbox.

=forms!whatform.listbox

Run the query from an event of the listbox.

Bonnie
http://www.dataplus-svc.com

Atif wrote:
I am using Access 2007.

Presently I am using a Command Button to call a Macro which opens a Query in
Pivot Chart view.

Now I want to use a ListBox which has these options NAE, NAW and EU. How can
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


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

  #3  
Old July 15th, 2008, 04:03 PM posted to microsoft.public.access.queries
Atif
external usenet poster
 
Posts: 45
Default Passing value to Query Criteria from a ListBox

Thanks:

I am using following criteria
=[Forms]![Switchboard]![ListSalesRegion.Column(0)]
it give error:
Microsoft Office Access database engin does to recognized
=[Forms]![Switchboard]![ListSalesRegion.Column(0)] as a vlid filed name or
expression

plz advise

"bhicks11 via AccessMonster.com" wrote:

Make the criteria for that field equal to the listbox.

=forms!whatform.listbox

Run the query from an event of the listbox.

Bonnie
http://www.dataplus-svc.com

Atif wrote:
I am using Access 2007.

Presently I am using a Command Button to call a Macro which opens a Query in
Pivot Chart view.

Now I want to use a ListBox which has these options NAE, NAW and EU. How can
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


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


  #4  
Old July 15th, 2008, 04:26 PM posted to microsoft.public.access.queries
bhicks11 via AccessMonster.com
external usenet poster
 
Posts: 529
Default Passing value to Query Criteria from a ListBox

The switchboard is doing some background stuff from a table. I wouldn't run
it off the switchboard, I'd open a little form with the selection.

Try that with this:

forms!switchboard.ListSalesRegion.Column(0)

Bonnie
http://www.dataplus-svc.com

Atif wrote:
Thanks:

I am using following criteria
=[Forms]![Switchboard]![ListSalesRegion.Column(0)]
it give error:
Microsoft Office Access database engin does to recognized
=[Forms]![Switchboard]![ListSalesRegion.Column(0)] as a vlid filed name or
expression

plz advise

Make the criteria for that field equal to the listbox.

[quoted text clipped - 13 lines]
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


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

  #5  
Old July 16th, 2008, 02:46 PM posted to microsoft.public.access.queries
Atif
external usenet poster
 
Posts: 45
Default Passing value to Query Criteria from a ListBox

Hi:

My form name is Switchboard. Why Query Criteria not able to recognized the
Listbox. I believe some syntex error. keep in mind i am using Access 2007.

Thanks

"bhicks11 via AccessMonster.com" wrote:

The switchboard is doing some background stuff from a table. I wouldn't run
it off the switchboard, I'd open a little form with the selection.

Try that with this:

forms!switchboard.ListSalesRegion.Column(0)

Bonnie
http://www.dataplus-svc.com

Atif wrote:
Thanks:

I am using following criteria
=[Forms]![Switchboard]![ListSalesRegion.Column(0)]
it give error:
Microsoft Office Access database engin does to recognized
=[Forms]![Switchboard]![ListSalesRegion.Column(0)] as a vlid filed name or
expression

plz advise

Make the criteria for that field equal to the listbox.

[quoted text clipped - 13 lines]
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


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


  #6  
Old July 16th, 2008, 05:58 PM posted to microsoft.public.access.queries
bhicks11 via AccessMonster.com
external usenet poster
 
Posts: 529
Default Passing value to Query Criteria from a ListBox

Before I go any further - did you create a form yourself and name it
switchboard or are you talking about the switchboard the system creates.

Bonnie
http://www.dataplus-svc.com

Atif wrote:
Hi:

My form name is Switchboard. Why Query Criteria not able to recognized the
Listbox. I believe some syntex error. keep in mind i am using Access 2007.

Thanks

The switchboard is doing some background stuff from a table. I wouldn't run
it off the switchboard, I'd open a little form with the selection.

[quoted text clipped - 22 lines]
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


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

  #7  
Old July 16th, 2008, 06:18 PM posted to microsoft.public.access.queries
Atif
external usenet poster
 
Posts: 45
Default Passing value to Query Criteria from a ListBox

Yes I created myself and named it as Switchboard

Atif

"bhicks11 via AccessMonster.com" wrote:

Before I go any further - did you create a form yourself and name it
switchboard or are you talking about the switchboard the system creates.

Bonnie
http://www.dataplus-svc.com

Atif wrote:
Hi:

My form name is Switchboard. Why Query Criteria not able to recognized the
Listbox. I believe some syntex error. keep in mind i am using Access 2007.

Thanks

The switchboard is doing some background stuff from a table. I wouldn't run
it off the switchboard, I'd open a little form with the selection.

[quoted text clipped - 22 lines]
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


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


  #8  
Old July 16th, 2008, 06:47 PM posted to microsoft.public.access.queries
Atif
external usenet poster
 
Posts: 45
Default Passing value to Query Criteria from a ListBox

I also tried:
=[Forms]![Menu].[List28]

the result the same, Not able to recogniazed as valid field name or expression

"Atif" wrote:

Yes I created myself and named it as Switchboard

Atif

"bhicks11 via AccessMonster.com" wrote:

Before I go any further - did you create a form yourself and name it
switchboard or are you talking about the switchboard the system creates.

Bonnie
http://www.dataplus-svc.com

Atif wrote:
Hi:

My form name is Switchboard. Why Query Criteria not able to recognized the
Listbox. I believe some syntex error. keep in mind i am using Access 2007.

Thanks

The switchboard is doing some background stuff from a table. I wouldn't run
it off the switchboard, I'd open a little form with the selection.
[quoted text clipped - 22 lines]
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


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


  #9  
Old July 16th, 2008, 07:34 PM posted to microsoft.public.access.queries
Michel Walsh[_2_]
external usenet poster
 
Posts: 56
Default Passing value to Query Criteria from a ListBox

A list box has no 'value', it just has lot of rows (selected or not), and
lot of columns. A text control, or a combo box do have a (one) value, not a
list box.


Vanderghast, Access MVP.

  #10  
Old July 16th, 2008, 07:35 PM posted to microsoft.public.access.queries
bhicks11 via AccessMonster.com
external usenet poster
 
Posts: 529
Default Passing value to Query Criteria from a ListBox

You need to not use the name Switchboard - the system uses it.

Bonnie
http://www.dataplus-svc.com

Atif wrote:
I also tried:
=[Forms]![Menu].[List28]

the result the same, Not able to recogniazed as valid field name or expression

Yes I created myself and named it as Switchboard

[quoted text clipped - 18 lines]
I pass selected option from listbox to query so that it only show the
specific region data i.e. NAE or NAW or EU.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200807/1

 




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 11:09 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.