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  

How refer to column of listbox in a query?



 
 
Thread Tools Display Modes
  #1  
Old June 25th, 2007, 10:37 PM posted to microsoft.public.access.queries
mscertified
external usenet poster
 
Posts: 835
Default How refer to column of listbox in a query?

How refer to column of listbox in a query?

My SQL:
SELECT ID, Category
FROM tblCategory
WHERE ID IN (SELECT CategoryID FROM tblOrgCatXref WHERE OrgID =
[Forms]![frmOrgCat]![lstOrgs].Column(0));

But I get 'invalid function' error.
  #2  
Old June 25th, 2007, 11:45 PM posted to microsoft.public.access.queries
Steve[_10_]
external usenet poster
 
Posts: 608
Default How refer to column of listbox in a query?

If the Bound Column property of lstOrgs is 1, Column(0) is the same value as
lstOrgs so you can remove ".Column(0)" from your expression.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications




"mscertified" wrote in message
...
How refer to column of listbox in a query?

My SQL:
SELECT ID, Category
FROM tblCategory
WHERE ID IN (SELECT CategoryID FROM tblOrgCatXref WHERE OrgID =
[Forms]![frmOrgCat]![lstOrgs].Column(0));

But I get 'invalid function' error.



  #3  
Old June 26th, 2007, 10:05 AM posted to microsoft.public.access.queries
StopThisAdvertising
external usenet poster
 
Posts: 334
Default How refer to column of listbox in a query?


"Steve" schreef in bericht news
If the Bound Column property of lstOrgs is 1, Column(0) is the same value as
lstOrgs so you can remove ".Column(0)" from your expression.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications


Hey Steve,

Look at the stats (Statcounter.com) to see the damage you have done to yourself.
Every time the link is shown, more and more people are reading about you.
http://home.tiscali.nl/arracom/SteveStats.html

Since you have been posting 'nice' the last couple of days the 'answering-machine' stops for now.
We will be watching you though...

ArnoR
  #4  
Old June 26th, 2007, 04:15 PM posted to microsoft.public.access.queries
RoyVidar
external usenet poster
 
Posts: 417
Default How refer to column of listbox in a query?

"mscertified" wrote in message
:
How refer to column of listbox in a query?

My SQL:
SELECT ID, Category
FROM tblCategory
WHERE ID IN (SELECT CategoryID FROM tblOrgCatXref WHERE OrgID =
[Forms]![frmOrgCat]![lstOrgs].Column(0));

But I get 'invalid function' error.


If the first column is the bound column, refer only to the listbox

WHERE OrgID = [Forms]![frmOrgCat]![lstOrgs]

If you are trying to refer to a column that isn't the bound column,
I think you'd need the Eval function

WHERE OrgID = Eval("[Forms]![frmOrgCat]![lstOrgs].Column(0)")

--
Roy-Vidar


 




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 02:24 PM.


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