Combo Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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)
 
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 said:
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

(no e-mails, please!)


JimS said:
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.
 
One other possibility would be to write a public function that returns the
desired value.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


JimS said:
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 said:
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

(no e-mails, please!)


JimS said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top