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  

Combo Box



 
 
Thread Tools Display Modes
  #1  
Old November 8th, 2006, 06:14 PM posted to microsoft.public.access.forms
JimS
external usenet poster
 
Posts: 252
Default Combo Box

What's wrong with the following used in the row source of a combo box on a
form with other controls (including cbVendorID)...

SELECT DISTINCTROW [tbl_Contracts].[ContractID],
[tbl_Contracts].[ContractNbr], [tbl_Contracts].[ContractReferencable],
[tbl_Contracts].[ReferenceContract],
[tbl_Contracts].[VendorID],
[tbl_Contracts].[ContractDate],
[tbl_Contracts].[ContractType], [tbl_Contracts].[ContractDescription]
FROM [tbl_Contracts]
WHERE vendorid=cbvendorID.column(1);

Access says i've go an undefined function in the WHERE clause.
--
Jim
  #2  
Old November 8th, 2006, 06:31 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Combo Box

I don't believe you can use the Column collection in a query. Even if you
could, you aren't telling Access on what form to find the combo box.

Try:

WHERE vendorid=Forms!NameOfForm!cbvendorID.column(1)

(although, as I said, I'm not sure that's legal)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"JimS" wrote in message
...
What's wrong with the following used in the row source of a combo box on a
form with other controls (including cbVendorID)...

SELECT DISTINCTROW [tbl_Contracts].[ContractID],
[tbl_Contracts].[ContractNbr], [tbl_Contracts].[ContractReferencable],
[tbl_Contracts].[ReferenceContract],
[tbl_Contracts].[VendorID],
[tbl_Contracts].[ContractDate],
[tbl_Contracts].[ContractType], [tbl_Contracts].[ContractDescription]
FROM [tbl_Contracts]
WHERE vendorid=cbvendorID.column(1);

Access says i've go an undefined function in the WHERE clause.
--
Jim



  #3  
Old November 8th, 2006, 09:17 PM posted to microsoft.public.access.forms
JimS
external usenet poster
 
Posts: 252
Default Combo Box

Yeah, tried that, but no joy. Looks like I'll have to do up an invisible
control or a vba variable. Thanks.
--
Jim


"Douglas J. Steele" wrote:

I don't believe you can use the Column collection in a query. Even if you
could, you aren't telling Access on what form to find the combo box.

Try:

WHERE vendorid=Forms!NameOfForm!cbvendorID.column(1)

(although, as I said, I'm not sure that's legal)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"JimS" wrote in message
...
What's wrong with the following used in the row source of a combo box on a
form with other controls (including cbVendorID)...

SELECT DISTINCTROW [tbl_Contracts].[ContractID],
[tbl_Contracts].[ContractNbr], [tbl_Contracts].[ContractReferencable],
[tbl_Contracts].[ReferenceContract],
[tbl_Contracts].[VendorID],
[tbl_Contracts].[ContractDate],
[tbl_Contracts].[ContractType], [tbl_Contracts].[ContractDescription]
FROM [tbl_Contracts]
WHERE vendorid=cbvendorID.column(1);

Access says i've go an undefined function in the WHERE clause.
--
Jim




  #4  
Old November 8th, 2006, 10:20 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Combo Box

One other possibility would be to write a public function that returns the
desired value.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"JimS" wrote in message
...
Yeah, tried that, but no joy. Looks like I'll have to do up an invisible
control or a vba variable. Thanks.
--
Jim


"Douglas J. Steele" wrote:

I don't believe you can use the Column collection in a query. Even if you
could, you aren't telling Access on what form to find the combo box.

Try:

WHERE vendorid=Forms!NameOfForm!cbvendorID.column(1)

(although, as I said, I'm not sure that's legal)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"JimS" wrote in message
...
What's wrong with the following used in the row source of a combo box
on a
form with other controls (including cbVendorID)...

SELECT DISTINCTROW [tbl_Contracts].[ContractID],
[tbl_Contracts].[ContractNbr], [tbl_Contracts].[ContractReferencable],
[tbl_Contracts].[ReferenceContract],
[tbl_Contracts].[VendorID],
[tbl_Contracts].[ContractDate],
[tbl_Contracts].[ContractType], [tbl_Contracts].[ContractDescription]
FROM [tbl_Contracts]
WHERE vendorid=cbvendorID.column(1);

Access says i've go an undefined function in the WHERE clause.
--
Jim






 




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 07:53 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.